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.
I tried many approaches to solve this problem, but none of them worked. I attempted the following:
I have a sandbox application called BETA-3
with the following credentials:
The previous sandbox application, BETA-3
, was issued with a sandbox business account with the following information:
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>
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:
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."
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.