I'd like not to create subscriptions but still be able to have the Recurring Billing approach in my SaaS software:
- Signup for a paid plan
- Apply Transaction Sale function
- Create braintree customer
- Save Payment Method Token in DB
- In the next month (whenever I want) use the Payment Method Token to create a new Transaction Sale
All of this without subscription feature. Does Braintree allow it?
Currently I'm having the following problem:
- The user signups for a paid plan
- The Transaction Sale is executed with the Nonce value
- I try to create the customer in Braintree using the same Nonce and I get the error "Cannot use a payment_method_nonce more than once"
The error makes sense, but how would I match the current user signup with the created customer in braintree in order to later use the Payment Method Token to re-use the Transaction Sale?
https://developer.paypal.com/braintree/docs/guides/customers#create-with-payment-method
// After the Transaction Sale is executed with success I try this:
$result = $gateway->customer()->create(
[
'firstName' => $customer['name'],
'company' => $customer['company'],
'email' => $customer['email'],
'paymentMethodNonce' => $customer['payment_method_nonce']
]);
This would return the Payment Method Token and I would be able to save in DB like this:
$db->braintree_customer_id = $braintreeCustomer->customer->id;
$db->braintree_payment_token = $braintreeCustomer->customer->paymentMethods[0]->token;
$db->save();
And in the next month, my software would be able to execute a payment using:
$result = $gateway->transaction()->sale(
[
'amount' => $price,
'paymentMethodToken' => $token, // <--- saved in DB
'options' =>
[
'submitForSettlement' => true
]
]);