'PayPal subscription payment is not working with sandbox

I have used the following code for PayPal subscribe button, from the sandbox.paypal.com:-


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

But, when clicking this button from the website (where I put this button code) and logging into the PayPal sandbox for the payment, it shows the following error message:-


Sorry, we couldn't set up your subscription using the payment method you selected. Please try another payment method.


I have tried all the available payment methods for my sandbox account(where from I am trying to subscribe). But nothing worked. I have been trying it for the last couple of hours, but it is not working.



Solution 1:[1]

Review your list of sandbox accounts, log into this button's account via www.sandbox.paypal.com and go to its email settings. Resend a confirmation "email" if necessary--sandbox doesn't send real email messages.

Read the confirmation "email" in the "Notifications" side tab of the developer dashboard, and use the link there to confirm it.

Retry your subscription payment after having confirmed the receiving sandbox account's primary email.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1