As per documentation what I had understood is, when we release funds from escrow, if there is any issue with sub-merchant if we setup a webhook for Disbursement Exception then it will be notified to us. Braintree will hit the endpoint url which we have configured in control panel with request parameters, I want to find for which transactions & sub-merchant issue is raised. From this doc its clear that transactions ids they will send in request parameters but its not clearly given about sub-merchant details anywhere in the doc.
I tried even sample payload, payload doesn't reflect actual request parameters. To know myself what parameters will be sent by Braintree when Disbursement Exception occurs I created a sub-merchant in sandbox using PHP SDK with destination as Braintree_Test_MerchantAccount::$bankRejectedUpdateFundingInformation, after that I created few sale transactions where funds has to release from escrow to newly create sub-merchant. From two days I'm waiting for that Braintree will hit endpoint url which I configured in control panel when it tries to release funds to sub-merchant but Braintee never hit endpoint url and still escrow status is Release Pending.
My question in-short: How to know for which sub-merchant disbursement exception is occurred when braintree webhook hit the endpoint url ?
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
In the case of a disbursement exception, the resulting webhook payload will still contain a disbursement object. The disbursement object will have a merchantAccount parameter, which contains info about the submerchant account for which disbursement failed, including id, the submerchant's merchant account ID. Here's the relevant page in the Braintree dev docs.
In code, here's what that looks like: once you've parsed the webhook notification and confirmed that $webhookNotification->kind is Braintree_WebhookNotification::DISBURSEMENT_EXCEPTION, then you can use
$webhookNotification->disbursement->merchantAccount->id
to get the ID. On the disbursement object, you also can get the reason for the failure with exceptionMessage, the list of transactions in the failed disbursement with transactionIds, and a suggested next step with followUpAction.
If you're using the latest version of the Braintree PHP SDK (currently 3.22.0), then on a sample notification, $webhookNotification->disbursement->merchantAccount->id will be set to "merchant_account_token".
Related
I have a small question about the Stripe workflow and there is one area in particular where I would like to know your opinion and experience. My setup is: Laravel 8 and "stripe/stripe-php": "^7.97".
The workflow as I understand it:
Client wants to pay with stripe
Client sends XHR request to application server (Laravel)
The server generates a Stripe payment intent with the Stripe Key.
Stripe sends back a key.
The server passes this key on to the client.
Stripe JS is loaded (https://js.stripe.com/v3/)
Stripe JS renders a payment form (credit card number etc).
The client enters his credit card details.
The client then clicks on "pay".
Stripe receives the client's credit card information along with the Stripe Payment Intent Key.
If the data is correct, the payment process is successfully completed at Stripe.
Stripe sends back the payment status information to the client as a response.
This information will then be sent from the client to the server.
The server can mark the order as completed.
My questions:
a) Have I understood the workflow correctly?
b) Would you already store the order in the database at the payment intention (Point 3.) or only at the last point (Point 14.)?
a) Your understanding is correct. But for Step 13 and 14 you would want to use Webhook to complete your order on Server instead. More intuitive guide is on Stripe's official document.
b) On Point 3 you can create an order but need to mark its status something like uncompleted. On Point 14 you can mark it completed and start providing your service. The reason is the customer can drop off between (ie not providing Card detail and simply close the browser).
I have this error, is it related to Braintree configuration or something in code?
This is method for payment.
$request->user()->newSubscription('main', $plan->braintree_plan)->create($request->payment_method_nonce);
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact
support.
If you are in a Production account, a processor decline indicates that the customer’s bank has refused the transaction request. Sometimes you can tell why it was declined by reading the response code, but only the customer's bank can confirm the specific reason. You can read the full list of decline response codes in our Declines documentation.
In you are testing in a Sandbox environment, processor declines are triggered by passing a specific test amount that corresponds with a decline code.
I am working on implementing Authorize.Net's Automated Recurring Billing API in Laravel Framework.
The scenario is I have a site, users sign up for our services and we charge them on monthly basis, and for that we have implemented automated recurring billing.
But I am unable to get the transaction id of successfully placed transactions.
ARB does not return a transaction ID when a payment is processed. It only establishes the recurring subscription. If you want transaction IDs of every successful subscription payment you will need to use one of two options available to you.
Webhooks
You can set up a webhook using the Webhooks API to be notified whenever a successful payment is made for a subscription. Although very little information is sent over with a webhook as it is best paired with the Transaction Details API, the transaction ID is one of the pieces of information sent with a webhook notification.
Silent Post
Silent Post is very similar to Paypal's IPN. Whenever a transaction is made Authorize.Net will send transaction details to a URL you specify which includes the transaction ID. Handling a Silent Post notification is easy as it looks exactly like a form submission.
Silent Post has been deprecated and will be going away so it is not recommended that you use this any more.
Disclosure: I wrote the articles about Webhooks and Silent Post.
I am trying to integrate the PayPal REST API into my Symfony 2 web app but I find hard to understand how exactly the complete workflow looks like:
The PayPal docs describe the following steps to accept a payment. One can use the PayPal Playground to simulate these steps:
Get an access token
Create a Payment object by querying the API
Redirect the user to the approval url received in the Payment response
After the user approved the payment on the PayPal page, he is redirected back to my page, using the success-link defined in the Payment object. Use the received information to execute the payment.
Payment is completed with status approved
From the docs: Once a payment is complete, it is referred to as a
sale. You can then look up the sale and refund it.
So far so good. BUT: Where are Webhooks used/fired in this workflow? I have defined a wildcard Webhook (accepting all possible events) in the PayPal Developer Dashboard.
My observation is, that my system receives the Webhook event 1-2 Minutes (!) after the user was redirected back to the success-link and after the payment was executed (Step 4).
Beside this long delay between executing the payment and receiving the Webhook, this workflow means, that I only receive the Webhook AFTER handling the success-link. This means, handling the success-link is absolutly necessary for the payment to be completed. Is this correct?
Do I need to use Webhooks?
I already asked this question a few days before and the answer by nifr is quite reasonable: One cannot trust the user to follow any redirect URL but should only rely on the Webhook events.
However this collides with the observations I described before, since I will never receive the Webhook without handling the redirect URL...
So, handling the PAYMENT.SALE.COMPLETED webhook event does not make a lot of sense, since this should already be done in when handling the redirect URL. Correct?
However, to handle updates on pending payments, handle refunds or reversed payments, etc. are only possible by listening on those events.
So the answer is: Only use Webhooks to get updates on payments made before. Correct?
So, the main questions are:
The 5-step process to accept payments does not say anything about using Webhooks. This does not seem to make a lot of sense, because without Webhooks one would miss update events, etc.? So, is it really possible to implement the complete payment workflow without Webhooks?
If yes, how are updates (refunds, pending, etc) handled in this case?
If no, what is the right strategy/time to fulfill the order since it take quite a long time to completly receive and handle the webhook?
i am still a newbie in PayPal world, but few days ago i integrated PayPal Plus REST API in an online Shop, and from my understanding i can tell that the workflow looks like:
create a Payment
redirect to PayPal
Payer could pay using PayPal account OR (using Bank Direct debit or Credit Card Payment without PayPal Account)
After completing the process on PayPal side, PayPal redirect the user back to your success URL.
till now the user is still not charged(you got no money). At the moment where you (in your success URL) do $payment->execute($paymentExecution,$api); , you ask Paypal to charge the amount from user. BUT also after this, you got no Money. Paypal have first to process the charging and notify you later via WebhookEvents.
the Webhook Notification (with that nasty delay) is especially important when the user pays per direct debit or Credit Card etc. Processing such Payments takes few seconds/minutes.
the redirectUrl ist absolutly necessary for charging/executing the Payment.
here on execution succeed, just to tell the user, that he finished his Job, and you can here save/capture the PaymentID/Transaction id for later usage/update via WebhookEvent Listener.
so i would recommend you to update your Database(Payment completed) only after receiving notofications via WebhookEvent Listener and not in the success RedirectUrl.
How can I capture paypal IPN and Authorize.net "Silent Post" messages?
I'm fine with how to make payments with Omnipay but I could not yet figure out how to listen to the callbacks from these APIs to detect changes for my payments.
For example Authorize.net processes it's credit card payments one time per day (late night for me) and then sends out it's messages via their so called "silent post" (its just a http POST) notifications. So the API call might be immediately "accepted" but I won't know for sure if everything is OK with the payment until I receive the callback.
So how do I set up Omnipay to listen to APIs that do these kind of delayed callbacks?
I'm aware that I'll need a callback URL like /payments/callback/ to load the right gateway to do something with the callback. But I could not yet figure out what method(s) from Omnipay I have to use for it.
Omnipay doesn't support notifications for existing payments. It automatically handles the first notification which is made directly after a payment, but doesn't yet have methods to handle notifications if you change the status of a payment (for example by refunding it from PayPal's control panel, it will not update in your database automatically).
Note this isn't needed for the initial payment. Especially with PayPal Express the payment is not confirmed until the customer returns to your site, so there is no chance of them closing the browser window and the payment being lost.
If you want to set up a notification endpoint and listen for events which happen after the payment is processed, you will need to add a new request type to Omnipay.