1

Can anyone tell me how to automatically execute a delayed payment (let's say it's 5 days after the primary receiver receive the payment) in a chained payment manner? The key is automatic execution, not having to manually approve and pay the secondary receiver. Please illuminate with some sample code.

I have used "actionType" => "PAY_PRIMARY" so that primary receiver get money.

But how can I code so that secondary receiver get money?

Parixit
  • 3,829
  • 3
  • 37
  • 61
user1206030
  • 11
  • 1
  • 3

3 Answers3

2

Check this answer for the solution. Basically you just need to execute an ExecutePayment operation with the payKey within 90 days to send the payment to the secondary party.

Community
  • 1
  • 1
istvanp
  • 4,423
  • 3
  • 24
  • 26
0

well may be its too late but it will help someone in future for sure. As we integrated paypal delayed chained payment, you can set a primary account in which all the amount will go and you can also set secondary account in which account will be transfered once they approved by primary account holder.

    string endpoint = Constants_Common.endpoint + "Pay";
     NVPHelper NVPRequest = new NVPHelper();
     NVPRequest[SampleNVPConstant.requestEnvelopeerrorLanguage] = "en_US";
    //NVPRequest[SampleNVPConstant.Pay2.actionType] = "PAY";
    //the above one is for simple adoptive payment payment 
     NVPRequest[SampleNVPConstant.Pay2.actionType] = "PAY_PRIMARY";
    //the above one for deleayed chained payment
     NVPRequest[SampleNVPConstant.Pay2.currencyCode] = "USD";
     NVPRequest[SampleNVPConstant.Pay2.feesPayer] = "EACHRECEIVER";
     NVPRequest[SampleNVPConstant.Pay2.memo] = "XXXXXXXX";

Now we have to set primary and secondary receivers:

    //primary account
        NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveramount_0] = TotalAmount;
        NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveremail_0] = "XXXx.xxxxx.com";
        NVPRequest[SampleNVPConstant.Pay2.receiverListreceiverprimary_0] = "true";
        //secondary accounts
        NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveramount_1] = (somemoney out of total amount);
        NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveremail_1] = "xxxxx.xxxx.com";
        NVPRequest[SampleNVPConstant.Pay2.receiverListreceiverprimary_1] = "false";
        NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveramount_2] = (somemoney out of total amount);
        NVPRequest[SampleNVPConstant.Pay2.receiverListreceiveremail_2] = x.x.com;
        NVPRequest[SampleNVPConstant.Pay2.receiverListreceiverprimary_2] = "false";

Don't forget that you have to give a valid paypal account while using delayed chained payment. Now you get your pay_key which you have to use to execute your payment whithin 90 days so that other secondary receivers get money. Here is the working code:

    String endpoint = Constants_Common.endpoint + "ExecutePayment";
    NVPHelper NVPRequest = new NVPHelper();
    //requestEnvelope.errorLanguage is common for all the request
    NVPRequest[SampleNVPConstant.requestEnvelopeerrorLanguage] = "en_US";
    NVPRequest[SampleNVPConstant.ExecutePayment.payKey] = "your pay key";
    string strrequestforNvp = NVPRequest.Encode();
    //calling Call method where actuall API call is made, NVP string, header value adne  end point are passed as the input.
    CallerServices_NVP CallerServices = new CallerServices_NVP();
    string stresponsenvp = CallerServices.Call(strrequestforNvp, Constants_Common.headers(), endpoint);
    //Response is send to Decoder method where it is decoded to readable hash table
    NVPHelper decoder = new NVPHelper();
    decoder.Decode(stresponsenvp);
    if (decoder != null && decoder["responseEnvelope.ack"].Equals("Success") && decoder["paymentExecStatus"].Equals("COMPLETED"))
    {
    //do something
    }

Hope it will help someone.

0

actionType is PAY_PPRIMARY you then trigger this payment within 90 days. Its delayed but not time-elapsed.

https://cms.paypal.com/cms_content/US/en_US/files/developer/PP_AdaptivePayments.pdf

Texman
  • 1
  • I'm sorry but can you elaborate? I did specify actionType as PAY_PRIMARY. Then how do I trigger the delayed second payment to the secondary receiver in 5 days automatically? – user1206030 Feb 15 '12 at 19:24