Skip to content
Loading
  
  •   
  •       
  •   

  • 0
  • 0
    OK i read this samples, but they are not in asp.net c#. Can you explain to me or give me some code example for how to can i create a product and plan with c#? Thank you.
    0
  • 0
    Hello Ansari,
    can you help me how can i create new product in c# using the example from paypal:
     
    1. curl -v -X POST https://api.sandbox.paypal.com/v1/catalogs/products \  
    2.   -H "Content-Type: application/json" \  
    3.   -H "Authorization: Bearer Access-Token" \  
    4.   -H "PayPal-Request-Id: merchant-generated-ID \ // Optional and if passed, helps identify idempotent requests  
    5. -d '{  
    6.   "name": "Video Streaming Service",  
    7.   "description": "Video streaming service",  
    8.   "type": "SERVICE",  
    9.   "category": "SOFTWARE",  
    10.   "image_url": "https://example.com/streaming.jpg",  
    11.   "home_url": "https://example.com/home"  
    12. }'  
     
    0
  • Imtiyaz Ansari
    0
    Hi @jordan
     
    Yes u can use product API using C# or ajax call and create product.. 
     and also u can check this link https://imtiyazansari.blogspot.com/2019/09/paypal-subscription-payment-in-angular.html
     
    ex. using javascript 
     
    1. basicAuth = 'Basic QVlvb25tdN3dKaWpfb1FnNjNYLTBCcjBlVGdHcjVzR4S1rT1ZZb3g0OVk4eWZ5SUpVVHY2UElaQj1pxb09vN19Cb25XbE92bDhhOW5ZaDZ3UU46RURUbEF3N3NwUGN4ajdkRTY3VXdJYW1obEJrdUtTRXFUUWqxNNmd1NHhWdURuRlV6cnJXMlZqaFMwek1rR3l6YWtqSlVnLWxHM0FZQjQtcFk=';  
     Create Product function 
     
     
    1. SaveProduct() { 
    2. var requestBody='{"name":"Toby Music Streaming Service","description":"Toby Music Streaming Service","type":"SERVICE","category":"SOFTWARE","image_url":"","home_url":""}';  

    3.   const xhttp = new XMLHttpRequest();  
    4.   xhttp.onreadystatechange = function () {  
    5.     if (this.readyState === 4 && this.status === 200) {  
    6.       console.log(JSON.parse(this.responseText));  
    7.       alert(JSON.stringify(this.responseText));  
    8.     }  
    9.   };  
    10.   xhttp.open('GET', 'https://api.sandbox.paypal.com/v1/catalogs/products', true);  
    11.   xhttp.setRequestHeader('Authorization', this.basicAuth);//pass your auth)  
    12.   
    13.   xhttp.send(requestBody);  
    14. }  
    0