简体   繁体   中英

Braintree client side paymentMethod purchase

I'm looking at the setup integration example:

braintree.dropin.create({
  authorization: 'CLIENT_AUTHORIZATION',
  container: '#dropin-container'
}, function (createErr, instance) {
  button.addEventListener('click', function () {
    instance.requestPaymentMethod(function (requestPaymentMethodErr, payload) {
      // Submit payload.nonce to your server
    });
  });
});

Would this be the same code to submit payment info to the server to update an existing subscription to a different plan or is that the method used only for new subscriptions? Is it the same call to Braintree and my server is the one responsible for what it does with it?

Disclaimer: I work for Braintree. If you need a more detailed answer, please don't hesitate to reach out to Braintree Support .

You can absolutely use the Drop-In UI to make a call to the API that will create or update a subscription.

That said, you will also have to build out logic on your server side to communicate with our API that you want to update a subscription. The documentation on Subscription.update() gives a detailed explanation on how to update your subscriptions using Braintree's SDKs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM