Jordan Trajkov

Jordan Trajkov

  • 1.6k
  • 163
  • 10.5k

How to make reccurent payment with paypal

Sep 12 2019 1:26 PM
Hello, ok i take a look to this article: https://developer.paypal.com/docs/subscriptions/

As i see paypal provide ready made SDK .NET Project which i download and i run it. Here they provide a option to create Billing Plan with product which is used for subscription as i understand. With this function i create a product plan and recive this  id: P-1FM52925BU386645MF32EE4A

Then i create new simple html page and add standard subscribe button with this code:

  1. <script src="https://www.paypal.com/sdk/js?client-id=[sandbox-client-id]&vault=true">  
  2. </script>  
  3.   
  4. <div id="paypal-button-container"></div>  
  5.   
  6. <script>  
  7. paypal.Buttons({  
  8.   
  9. createSubscription: function (data, actions) {  
  10.   
  11. return actions.subscription.create({  
  12.   
  13. 'plan_id''P-1FM52925BU386645MF32EE4A'  
  14.   
  15. });  
  16.   
  17. },  
  18.   
  19.   
  20. onApprove: function (data, actions) {  
  21.   
  22. alert('You have successfully created subscription ' + data.subscriptionID);  
  23.   
  24. },  
  25.   
  26. onError: function (err) {  
  27. // Show an error page here, when an error occurs  
  28. alert('Here is error: '+ err);  
  29. },  
  30.   
  31. onCancel: function (data) {  
  32. // Show a cancel page, or return to cart  
  33. }  
  34.   
  35.   
  36. }).render('#paypal-button-container');  
  37.   
  38. </script>  
Then i can see the subscribe button and if i click i recive an error like in the image below:
Inline image
It seems like he cannot find the plan, but if use SDK .NET project to get all plans i can see that the plan exist.
Also i take a look in my developer account in API calls section and i can see this:
Inline image
There are some warning probably becasue of the error i see after clickin subscribe button but without any explanation. At this image we can see that the billing plan is created succesfully.

Can you please help me what is wrong?

Answers (4)