we are using Paypal to process payments on our website. We offer monthly subscriptions to our customers and transfer a certain amount of credits to their accounts according to their purchased subscriptions. But the customer can also purchase add-ons for some extra credits which are one-time payments.
We have worked with recurring and one-time payments separately using "react-paypal-button-v2" react package.
Subscription
<PayPalButton
createSubscription={(data, details) => createSubscription(data, details)}
onApprove={(data, details) => onApprove(data, details)}
onError={(err) => onError(err)}
catchError={(err) => catchError(err)}
onCancel={(err) => onCancel(err)}
options={{
clientId: "",
vault: true
}}
/>
One-time payment
<PayPalButton
createOrder={(data, details) => createOrder(data, details)}
onApprove={(data, details) => onApprove(data, details)}
onError={(err) => onError(err)}
catchError={(err) => catchError(err)}
onCancel={(err) => onCancel(err)}
options={{
clientId: "",
vault: true
}}
/>
Is there a way to handle both of these in one transaction, so customers can purchase subscriptions and add-ons together? Thanks.