Local Payment Methods
Server-Side Implementation
Local Payment Method webhooks
- If you can complete your checkout flow without the customer returning to your app or website, then use Local Payment Method webhooks to create the transaction and charge the customer.
- If you need the customer to return to your app or website to complete your checkout flow, then inform the customer to do so. If they don't, and you are unable to create the transaction within 3 hours of invoking the checkout flow, Braintree will auto-refund the money to the customer.
- If a transaction was not created, Braintree will initiate the refund of the money to the customer and will send you the local_payment_reversed webhook . You can use this webhook to notify your buyer that their funds will be returned and to expect them within 2-3 days.
Configure webhooks
- JSON
{
"local_payment": {
"payment_id": "the_payment_id",
"payment_method_nonce": "nonce_from_the_webhook"
}
}
Creating transactions
There are two ways to create a local payment transaction; in both cases, your server will receive a payment_method_nonce that can be used to create the transaction. To successfully integrate with Local Payment Methods, you must support both of these methods:
- If the customer does return to your app or website after completing the payment with their bank, then you must create the transaction using the payment_method_nonce sent to your server by your client.
- If the customer does not return to your app or website after completing the payment with their bank, then you must create the transaction using the payment_method_nonce contained in the Local Payment Method webhook sent to your server.
Once your server receives a payment_method_nonce, include the
paymentMethodNonce
parameter in the Transaction: Sale
call
on your server. Because Local Payment Methods only support single-use, one-time payments,
submit_for_settlement must be set to
true.
Optional fields
- order_id - a merchant-generated ID associated with the transaction
- descriptor_name - a descriptor that will show in the user's bank statement
- PHP
$result = $gateway->transaction()->sale([
'amount' => $_POST['amount'],
'paymentMethodNonce' => nonce_from_the_client_or_webhook,
'orderId' => $_POST["Order 1234"],
'descriptorName' => $_POST["Merchant ABC"],
'options' => [
'submitForSettlement' => True, # Required
],
]);
if ($result->success) {
print_r("Success ID: " . $result->transaction->id);
} else {
print_r("Error Message: " . $result->message);
}
Currency support
The currency of transactions for use with Local Payment Methods needs to match the currency set in the client integration.