Get your credentials from Braintree
Pick the environment
Open the API keys
Copy the credentials
Prepare the Braintree account
Add the custom fields
plan_db_id, plan_id and user_id with every one-time sale, and user_id when it creates a customer for a subscription. Braintree only accepts custom fields that exist in your Control Panel, so add all three there and set them to store and pass back. Follow Braintree’s custom fields guide. Without them the sale is rejected.Create a plan for each recurring plan
Match the billing frequency
Create the webhook in Braintree
Open the webhook settings
Enter the URL
Select the notifications
Add the credentials in MagicPost
Open the Braintree card
Enable it
Paste the keys
- Live Braintree Public Key
- Live Braintree Private Key
- Sandbox Braintree Public Key
- Sandbox Braintree Private Key
Paste the Merchant ID
Save
How payments work
All plans. MagicPost opens a page with the Braintree Drop-in. The customer enters a payment method and taps Pay now. Monthly and Yearly plans show a Recurring label. A Cancel link returns to the Billing page. One-time plans (Prepaid, Lifetime). MagicPost makes a Braintree sale for the plan price, submitted for settlement, using the payment method from the Drop-in. It records the order from the Braintree transaction ID. For Lifetime plans it also creates the subscription. Recurring plans (Monthly, Yearly). MagicPost creates a Braintree customer with the payment method, then a Braintree subscription on the matching plan. The Braintree subscription ID becomes the order reference and the subscription reference, and MagicPost stores the Braintree customer ID and payment method token with the subscriber. Webhook.- Subscription charged successfully extends the subscriber’s period and renews the credit allowance.
- Subscription canceled and subscription expired mark the subscription as cancelled.
Currency
MagicPost sends the plan price with two decimals and no currency code, so Braintree charges in the currency of your merchant account. Set the plan’s currency to match it.Test mode
Create a Braintree sandbox account, enter its keys in the two Sandbox key fields and its Merchant ID in Braintree Merchant ID, select Sandbox under Mode and save. Create the custom fields, plans and webhook in the sandbox Control Panel as well. Switch Mode back to Live and update the Merchant ID before you sell.Common errors
This payment method is not available right now.
This payment method is not available right now.
Braintree could not start the payment. Please try again.
Braintree could not start the payment. Please try again.
No Braintree plan found matching any of [...]
No Braintree plan found matching any of [...]
Braintree did not approve the payment: ...
Braintree did not approve the payment: ...
Braintree subscription create failed: ... / Braintree customer create failed: ...
Braintree subscription create failed: ... / Braintree customer create failed: ...
Missing Braintree payment nonce.
Missing Braintree payment nonce.
Braintree shows the webhook failing with status 400
Braintree shows the webhook failing with status 400
invalid signature: the Private Key saved for the active Mode is not the one for the account that sent the notification.
