paypalpaypal-sandboxpaypal-subscriptions

Sandbox Subscription Payment Fails with "Sorry, we couldn't set up your subscription"


The main problem is that when I try to make a payment in the sandbox environment (using the sandbox application and accounts), I get this error.

PayPal Error

What I Tried to Solve This Problem

I tried many approaches to solve this problem, but none of them worked. I attempted the following:


The Whole Workflow

1. I have Sandbox application

I have a sandbox application called BETA-3 with the following credentials:


2. Sandbox Business Account Info

The previous sandbox application, BETA-3, was issued with a sandbox business account with the following information:


3. Created Plans Using the Sandbox Business Account

Using the previous sandbox business account, I created a subscription product and plans as follows:

I have attached the payment_button.html file along with this PDF file.

<div id="paypal-button-container-P-1L3398487N541401BM72AGAA"></div>
<script src="https://www.paypal.com/sdk/js?client-id=Achaeq7LP-oQgawYPr_3R5z1XYte-lqh307AcB8uDVs4OBe3uk7RlKTe1ZpCg64W_MESbX56twhQIZcX&vault=true&intent=subscription" data-sdk-integration-source="button-factory"></script>
<script>
  paypal.Buttons({
      style: {
          shape: 'rect',
          color: 'gold',
          layout: 'vertical',
          label: 'subscribe'
      },
      createSubscription: function(data, actions) {
        return actions.subscription.create({
          /* Creates the subscription */
          plan_id: 'P-1L3398487N541401BM72AGAA'
        });
      },
      onApprove: function(data, actions) {
        alert(data.subscriptionID); // You can add optional success message for the subscriber here
      }
  }).render('#paypal-button-container-P-1L3398487N541401BM72AGAA'); // Renders the PayPal button
</script>

4. Test the Payment Using a Sandbox Personal Account

After I created the HTML file with the content from the previous step, I opened it. I tested making a payment using a sandbox personal account with the following credentials:

The initialization of the payment was successfully completed (Subscription creation was successful) as shown below:

PayPal Payment Initialization

But when I complete the payment and click on "Agree & Subscribe," the following error message is displayed: "Sorry, we couldn't set up your subscription using the card you selected. Please try another card."

PayPal payment issue


5. What I Did to Try to Solve This Problem


Solution

  • The problem is with the EG receiving account. EG is one of the countries for which 'Automatic Transfers' must be enabled, per the user agreement: https://www.paypal.com/eg/legalhub/paypal/recpymt-full . This can be done in the www.sandbox.paypal.com account interface. If it is not done, the account cannot receive any payments.

    An alternative is to create a new sandbox business account for a different country, such as US. You will need to use the Client ID and Secret of a new app created for that sandbox account, as well as a new P- plan ID created with/in that account.