Refund payment by order line item ID - square-connect

Can I refund an Order/Payment by specifying the the uid of the OrderLineItem instead of specifying a Money?

Not via the API, but you could via the Dashboard or POS application. The API currently does not support itemized refunds.
https://developer.squareup.com/reference/square/refunds-api/refund-payment

Related

Spring: Paypal Payment on new currencies results to PENDING capture status

I think this is not a code problem since my application can successfully pay and process payments using my account currencies (usd/php/hkd).
Since there was a new requirement to support some currencies (sgd, eur, jpy, etc), I added these currencies Account Settings > Money, banks, and cards.
Btw, I am using paypal order and payment version 2 on spring.
The application was able to pass the currency and value of the transaction (like what I do normally with USD/EUR/PHP).. It was able to create order object, authorized approved payment... but it the capture authorized payment is always stucked at PENDING.
I still need to check on my test paypal account and either Accept/Reject received payment.
However, my application is only checking for COMPLETED capture status for it to considered or mark it as successful payment.
I also tried the configuration on my test paypal account (Account Settings > Payment Preferences > Block Payments).
Tried selecting Yes, accept and convert them to... and Ask me whether to accept or deny each individual payment but the capture status is still PENDING.
Is there a way to proceed with the capture payment and have the status to COMPLETED? Even with payments of different currencies? It would be OK if the payment received will be stored on that currency or have it converted to my default currency (like USD, etc).
What I want is the capture status to proceed to COMPLETED without manually accepting/rejecting payments with other currency (newly added currencies).
Again, I think this is not a coding issue... more of a configuration issue.. but I am not sure which configuration and where to set. I am pretty new with paypal development.
By the way, I based my changes on my paypal account with this link:
Payment Receiving Preferences
TIA
This is standard PayPal behavior. If you accept the first payment in a new currency in a way that opens a balance in such a currency, future payments won't need to be manually accepted. You can also manually open $0 balances in the Money management section, https://www.paypal.com/businessmanage/account/money
The setting in Account Settings > Payment Preferences > Block Payments that you mention to convert non-balance currency transactions to your primary balance will only apply automatically to future payments. Their status should then not be 'PENDING' due to any currency issue.
(If you find that all payments are PENDING, even your primary balance ones, then the pending reason (as stated in the API response) is likely "authorization" -- meaning you created an authorization with intent:AUTHORIZE but haven't captured it yet. Change to intent:CAPTURE to capture immediately.)

Braintree hosted fields integration - edit existing card data

I'm using Braintree hosted fields to allow credit card payments, and users can use multiple cards.
How can I allow users to edit existing cards? For example, when a card is renewed by the bank, it keeps the same card number, but the expiration date and CVV change. I want users to be able to edit the expiration date and CVV to keep the card active. Is this possible, or does the user have to enter in a new card from scratch with the same card number?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support
Once your customer has their payment method stored in a Vault record you can use their associated payment method token to run a PaymentMethod.update() call. Using the payment method update you can change most attributes of the stored method, and you can find a full list of those attributes here. When updating actual card information, such as CC number, expiration date, etc. it is recommended that you generate a nonce with the new information rather than entering it manually, but either will work just fine.

Find braintree payment method token when failOnDup for paymentMethod.create is called

I'm trying to create a customer and subscription in the same workflow.
My logic requires that the email be unique so no two vaulted customers will have the same email.
My workflow is to only create a customer if the customer isn't found in the vault. The customer creation process includes the payment method. I need the paymentMethod token in order to create the subscription.
My hope was to not add duplicate paymentMethods so I'm using {failOnDuplicatePaymentMethod: true}. However, given a nonce and a customer, I can check if the customer is a dup, and I can check if the paymentMethod is a dup - but how do I get that exact paymentMethod token if the customer has N payment methods?
I assumed that the failOnDup would return the token of the dup Payment method - but that isn't the case.
What I'm trying to do is have a single subscription signup with email and payment but a customer can enter a different credit card for each subscription. I want the customer to have a single vaulted account, with N payment methods but I need the paymentMethod token of the last paymentMethod in order to create the subscription.
Full disclosure: I work as a developer for Braintree
Braintree does not support a way to retrieve the duplicate payment method after a payment method fails to create because a duplicate payment method exists.
You can retrieve the payment methods from an existing customer and present them via our Drop-in or your own custom integration. I recommend reaching out to Braintree support to help you with your integration and figure out all of your options.

Can we search for Order ID linked to Payment ID through Square Connect API?

Is there a way using the Square Connect API to take a payment ID sent via webhook and find the associated Order ID?
I find it odd that the Payment object listed in the documentation (https://docs.connect.squareup.com/api/connect/v1/#datatype-payment) does not have an order_id value or the Orders API does not have a get/order_by_payment_id option (https://docs.connect.squareup.com/api/connect/v1/#navsection-orders).
Are there plans to implement either of these options?
It is not currently possible to get a Payment object's associated order ID with the Connect API.
I have filed a feature request with the API development team.

Braintree : How can i select a payment method and obtain a payment method nonce using a custom UI?

I am trying to use braintree for payments in a web application. The flow i'm after is :
user registration : create a Braintree customer, associate its id with the user
first payment : show a custom UI for the credit card information, use the Braintree tutorial for adding a credit card and make the payment.
second payment : show a list of payment methods for the customer. When he/she selects one, make a payment using the selected payment method.
I am stumped at how i'm supposed to implement the second payment part. Assuming i keep payment methods info and show the client a list of payment methods, how do i obtain a payment method nonce i need to be able to execute a sale Transaction?
To clarify, i'm not using the Dropin UI because :
i need more information than it can show when entering a credit card (like cardholder)
i need to have a custom look-and-feel ui in different languages
I've read the Braintree guides and reference and i couldn't find and resource for a custom ui where i can reuse the payment method information.
Any input is highly appreciated.
I work at Braintree. If you need more help, I suggest you email our support team.
When you store a credit card (by passing a nonce to credit card or payment method create) the response you get back contains a token. You can store this token permanently and use it in the future to make payments on the same card.
You can charge the user with his payment token or customer id: https://developers.braintreepayments.com/guides/transactions/ruby#sale-with-vaulted-payment-methods
result = Braintree::Transaction.sale(
:payment_method_token => "the_token",
:amount => "10.00"
)
# or
result = Braintree::Transaction.sale(
:customer_id => "the_customer_id",
:amount => "10.00"
)

Resources