简体   繁体   中英

Creating a PayPal Subscription Button in Sandbox mode

I am trying to setup a sandbox for PayPal Smart Buttons to test before I release to production.

When I go to PayPal Subscriptions , I select my plan and click 'Copy Code'. The result is:

<div id="paypal-button-container"></div>
<script src="https://www.paypal.com/sdk/js?client-id=XXX&vault=true" data-sdk-integration-source="button-factory"></script>
<script>
  paypal.Buttons({
      ....
      createSubscription: function(data, actions) {
        return actions.subscription.create({
          'plan_id': 'P-YYYY'
        });
      },
      onApprove: function(data, actions) {
        alert(data.subscriptionID);
      }
  }).render('#paypal-button-container');
</script>

Is there a way to enable sandbox for logging in? I see that I can create sandbox accounts at Developer Accounts page but the sandbox accounts created there do not work (I mean how is it supposed to know I am in 'sandbox mode'?)

The sandbox and live environments are completely separate.

Using a sandbox business account, log into the www.sandbox.paypal.com environment, and then you can go to:

https://www.sandbox.paypal.com/billing/overview (same as your link, but with ' sandbox. ' in the URL.

Create sandbox plans there. These sandbox subscriptions can be tested with sandbox personal accounts.

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