NVP SOAP

DOCS

Last updated: Aug 15th, 7:32am

Integration steps

1.RequiredSet up your development environment.
2.RequiredSet transaction context. To Integrate Transaction Risk with Express Checkout, you must first set the transaction context after the customer initiates a check out but before the customer is redirected to PayPal to make the payment. You pass a merchant_id and tracking_id in the call. The initial Express Checkout call returns a token that you use as the tracking_id value in the set the transaction context call.
3.RequiredRedirect the customer to PayPal for approval. PayPal recognizes that the Express Checkout token matches the token that the set transaction context call returned. Consequently, PayPal uses the transaction data context that is associated with this token to complete additional risk management before the payment processes.
4.OptionalShow payment details.
5.RequiredComplete the transaction.

Set up your development environment

Before you can integrate Express Checkout with Transaction Risk, you must set up your development environment. After you get a token that lets you access protected REST API resources, you create sandbox accounts to test your web and mobile apps. For details, see Get started.

Then, return to this page to integrate Express Checkout with Transaction Risk.

Set the transaction context

Use the token value from the response in the previous step as the tracking_id parameter and use the merchant ID from PayPal business account Profile page as the merchant_id parameter in the request:

    1curl -v -X PUT \
    2 https://api-m.sandbox.paypal.com/v1/risk/transaction-contexts/<merchant_id>/<tracking_id> \
    3 -H 'Content-Type: application/json' \
    4 -H 'Authorization: Bearer <Access-Token> \
    5 -d '{
    6 "additional_data": [
    7 {
    8 "key": "test1",
    9 "value": "abc"
    10 },
    11 {
    12 "key": "test2",
    13 "value": "aaa"
    14 }]
    15}'

    Redirect the customer to PayPal for approval

    Redirect the customer to PayPal for approval.

    Using the token value returned from set the transaction context call, redirect the customer to PayPal so that he or she can approve the transaction:

      1https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=<tokenValue>

      The redirect presents the customer with a PayPal log-in page. After the customer logs in, PayPal displays the transaction details on the Payments Review page. To approve the payment on this page, the customer clicks Continue.

      Show payment details

      Show payment details.

      If the customer approves the payment, make a classic GetExpressCheckoutDetails call to get the PayerID, which uniquely identifies the customer, and any other details required for transaction processing.

      For example, the transaction details can be used to display the customer's shipping data, and other information, on the payment confirmation page.

      In this GetExpressCheckoutDetails request, replace tokenValue with the token from the SetExpressCheckout response:

        1curl -s --insecure https://api-3t.sandbox.paypal.com/nvp -d \
        2 "USER=<callerID> \
        3 &PWD=<callerPswd> \
        4 &SIGNATURE=<callerSig> \
        5 &METHOD=GetExpressCheckoutDetails \
        6 &VERSION=93 \
        7 &TOKEN=<tokenValue>"

        The response shows transaction details:

          1TOKEN=EC%2d4RX1920730957200V
          2...
          3&PAYERID=6B9DKHQRKW4SG
          4...
          5&WALLETTYPE0=MERCHANT_COUPON
          6&WALLETID0=COUP3456
          7&WALLETDESCRIPTION0=Acme Inc. coupon
          8
          9&WALLETTYPE1=LOYALTY_CARD
          10&WALLETID1=LY3456
          11&WALLETDESCRIPTION1=Acme Inc. Loyalty Program
          12...
          13&INSTRUMENTCATEGORY=2
          14&INSTRUMENTID=982345

          Complete the transaction

          Complete the transaction.

          When the customer confirms the payment, DoExpressCheckoutPayment is called to capture the payment.

          Specify the PayerID and token value returned from the previous calls. You can also specify the coupons or loyalty rewards being applied towards the payment. You can also pass custom data with the transaction in the merchant data key and value pair fields.

            1curl -s --insecure https://api-3t.sandbox.paypal.com/nvp -d \
            2 "USER=<callerID> \
            3 &PWD=<callerPswd> \
            4 &SIGNATURE=<callerSig> \
            5 &METHOD=DoExpressCheckoutPayment \
            6 &VERSION=93 \
            7 &TOKEN= <token>\
            8 &PAYERID= # customer's unique PayPal ID \
            9 &PAYMENTREQUEST_0_PAYMENTACTION=SALE # payment type \
            10 &PAYMENTREQUEST_0_AMT=19.95 # transaction amount \
            11 &PAYMENTREQUEST_0_CURRENCYCODE=USD" # transaction currency such as US dollars \
            12 ...
            13 &L_PAYMENTREQUEST_0_REDEEMEDOFFERNAME0=Acme Inc. Loyalty Program \
            14 &L_PAYMENTREQUEST_0_REDEEMEDOFFERDESCRIPTION0=Applicable to all purchases \
            15 &L_PAYMENTREQUEST_0_REDEEMEDOFFERAMOUNT0=5 \
            16 &L_PAYMENTREQUEST_0_REDEEMEDOFFERTYPE0=LOYALTY_CARD \
            17 &L_PAYMENTREQUEST_0_REDEEMEDOFFERID0=ACME1223611 \
            18 &L_PAYMENTREQUEST_0_REDEEMEDOFFERPOINTSACCRUED0=50 \
            19 ...
            20 &L_PAYMENTREQUEST_0_CUMMULATIVEPOINTSNAME0=Acme Inc. Loyalty Program \
            21 &L_PAYMENTREQUEST_0_CUMMULATIVEPOINTSDESCRIPTION0=Applicable to all purchases \
            22 &L_PAYMENTREQUEST_0_CUMMULATIVEPOINTSTYPE0=LOYALTY_CARD \
            23 &L_PAYMENTREQUEST_0_CUMMULATIVEPOINTSID0=ACME1223611 \
            24 &L_PAYMENTREQUEST_0_CUMMULATIVEPOINTSACCRUED0=526 \
            25 ...
            26 &L_PAYMENTREQUEST_0_MERCHANTDATAKEY0=PLCC_PROMO_CODE \
            27 &L_PAYMENTREQUEST_0_MERCHANTDATAVALUE0=872345

            When PayPal processes the classic DoExpressCheckoutPayment call, it captures the payment by transferring the funds from the customer's account to the appropriate merchant account and sends a confirmation e-mail to the customer.

            Additional information

            For information about classic payment calls, see:

            NVPSOAP
            CreateBillingAgreement API Operation (NVP)CreateBillingAgreement API Operation (SOAP)
            DoReferenceTransaction API Operation (NVP)DoReferenceTransaction API Operation (SOAP)
            DoExpressCheckoutPayment API Operation (NVP)DoExpressCheckoutPayment API Operation (SOAP)
            GetExpressCheckoutDetails API Operation (NVP)GetExpressCheckoutDetails API Operation (SOAP)
            Pay API Operation
            SetExpressCheckout API Operation (NVP)SetExpressCheckout API Operation (SOAP)

            We use cookies to improve your experience on our site. May we use marketing cookies to show you personalized ads? Manage all cookies