Search code examples
c#paypalpaypal-sandbox

PayPalAPIInterfaceServiceService and SetExpressCheckout config / credential information


I created an app in my business account on this page:

https://developer.paypal.com/developer/applications/

When I click on the app I created I see the following:

Sandbox account, Client ID, and Secret.

I am trying to call SetExpressCheckout… but the documentation is unclear and examples are all over the map.

Basically I’m seeing things like:

        var request = new SetExpressCheckoutReq() { … };
        
        var config = new Dictionary<string, string>()
        {
            { "mode", "sandbox" },        // some variations of these values
            { "clientId", "fromAbovePage" },
            { "clientSecret", "fromAbovePage" },
            { "sandboxAccount", "fromAbovePage" },
            { "apiUsername", "IDontKnow" },
            { "apiPassword", "IDontKnow" },
            { "apiSignature", "IDontKnow" }
        };
        var service = new PayPalAPIInterfaceServiceService(config);
        var response = service.SetExpressCheckout(request, new SignatureCredential(config["apiUsername"], config["apiPassword"], config["apiSignature"]));

Also, kind of weird that credentials go into both the PayPalAPIInterfaceServiceService and the actual SetExpressCheckout call.

What are (and where do I get) the correct values for the above config? (the request itself I have pretty much figured out)

Note: PayPal support told me that I need to use Reference Transactons in order to charge varying amounts over potentially varying times without subsequent user interaction, if that is relevant.

I would love to see examples of this with the most recent API's if anyone has that information as well.

Thank you.


Solution

  • SetExpressCheckout is a legacy NVP API


    ClientID/Secret credentials are used for the current v2/checkout/orders REST API, which at the moment does not have any public documentation for vaulting or reference transactions; it is for one time payments. You can find information for a server-side integration at https://developer.paypal.com/docs/checkout/reference/server-integration/

    If you are using this REST API integration, create two routes --one for 'Set Up Transaction' and one for 'Create Transaction'. Then pair them with this approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server