locked
Need help on Chained Payment using Adaptive Payments from Paypal. RRS feed

Answers

  • User-893317190 posted

    Hi sky_091006@hotmail.com,

    Have you tried  sdk of paypal for c#?

    This two aspx deals with chainded payment.

    https://github.com/paypal/adaptivepayments-sdk-dotnet/blob/master/Samples/AdaptivePaymentsSampleApp/UseCaseSamples/ChainedPayment.aspx

    https://github.com/paypal/adaptivepayments-sdk-dotnet/blob/master/Samples/AdaptivePaymentsSampleApp/UseCaseSamples/RequestResponse.aspx.cs

    Please download the sdk through nuget. Just Search for PayPalCoreSDK.

    Below is a small sample.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style>
            body {
    	
    }
    
    table th {
    	font-weight: normal;	
    }
    
    #permissionsdata {
    	margin-top: 20px;
    }
    
    #permissionsdata td {
    	padding: 10px 20px;
    }
    
    #permissionsdata td.left {
    	border-right: solid 1px gray;
    }
    
    .overview {
    	padding: 10px 20px;
    	font-style: italic;
    	width: 75%;
    }
    
    input.smallfield, select.smallfield {
    	width: 105px;
    	font-size: 12px;
    }
    
    input.xsmallfield, select.xsmallfield {
    	width: 75px;
    	font-size: 12px;
    }
    
    .open {
    	display: block;
    }
    
    .closed {
    	display: none;
    }
    
    #apidetails {
    	padding: 10px 20px 30px 20px;
    	font-style: italic;
    	width: 75%;
    }
    
    .note {
    	margin: 10px 10px;
    	font-style: italic;
    }
    
    .section_header {
    	margin: 20px 0px;
    	font-weight: bold;
    }
    
    .submit {
    	margin-top: 20px;
    	margin-bottom: 20px;
    }
    
    ul.wizard {
    	font-size: 16px;
    	color: gray;
    	list-style-type: none;
    }
    
    ul.wizard li {
    	width: 20%;
    }
    
    ul.wizard li.current {
    	color: black;
    	font-weight: bold;
    }
    
    ul.wizard li.complete {
    	color: black;
    	background-image: url(images/tick.png);
    	background-repeat: no-repeat;
    	background- right;
    	padding-right: 50px;
    }
        </style>
        <script src="../Scripts/jquery-3.3.1.js"></script>
    <!--you could get the js in the gidhub address for .net sdk--> <script src="sdk_functions.js"></script> </head> <body> <div id="wrapper"> <div id="header"> <h3>Chained Payment</h3> <div id="apidetails"> <p> <i>A Chained Payment is a Payment from a sender that is indirectly split among multiple receivers. It is an extension of a typical Payment from a sender to a receiver, in which a receiver, known as the Primary Receiver, passes part of the Payment to other Receivers, who are called Secondary Receivers. Create your PayRequest message by setting the common fields. If you want more than a Simple Payment, add fields for the specific kind of request, which include Parallel Payments, Chained Payments, Implicit Payments, and Preapproved Payments. </i> </p> </div> </div> </div> <form id="form1" runat="server"> <div id="request_form"> <div class="params"> <div class="param_name"> Currency Code*</div> <div class="param_value"> <asp:TextBox runat="server" ID="currencyCode" Text="USD" /> </div> <div class="param_name"> Action Type*</div> <div class="param_value"> <asp:DropDownList runat="server" ID="actionType"> <asp:ListItem Text="Pay" Value="PAY" Enabled="True" Selected="True" /> <asp:ListItem Text="Pay Primary" Value="PAY_PRIMARY" /> <asp:ListItem Text="Create" Value="CREATE" Enabled="false" /> </asp:DropDownList> </div> <div class="param_name"> Cancel URL*</div> <div class="param_value"> <asp:TextBox runat="server" ID="cancelURL" /> </div> <div class="param_name"> Return URL*</div> <div class="param_value"> <asp:TextBox runat="server" ID="returnURL" /> </div> <div class="param_name"> IPN Notification URL (For receiving IPN call back from PayPal) </div> <div class="param_value"> <asp:TextBox runat="server" ID="ipnNotificationURL" /> </div> <div class="param_name"> Sender Email </div> <div class="param_value">
    <!-- input your sender--> <asp:TextBox runat="server" ID="senderEmail" Text="v-acxu-buyer@hotmail.com" /> </div> <div class="section_header"> Receiver </div> <div class="note"> <i>Receiver is the party where funds are transferred to. A Primary Receiver receives a Payment directly from the sender in a Chained Split Payment. A Primary Receiver should not be specified when making a single or Parallel Split Payment. At most one Receiver can be set as Primary Receiver. </i> </div> <table> <tr> <th class="param_name"> Amount* </th> <th class="param_name"> Email* </th> <th> Primary Receiver </th> </tr> <tr> <td class="param_value"> <asp:TextBox runat="server" ID="amount1" Text="3.00" /> </td> <td class="param_value">
    <!--input the first receiver--> <asp:TextBox runat="server" ID="mail1" Text="v-acxu-facilitator@hotmail.com" /> </td> <td> <asp:DropDownList runat="server" ID="primaryReceiver1"> <asp:ListItem Text="True" Value="true" Selected="True" /> <asp:ListItem Text="False" Value="false" Enabled="false" /> </asp:DropDownList> </td> </tr> <tr> <td class="param_value">
    <!--input the second receiver--> <asp:TextBox runat="server" ID="amount2" Text="2.00" /> </td> <td class="param_value"> <asp:TextBox runat="server" ID="mail2" Text="luan-facilitator@hotmail.com" /> </td> <td> <asp:DropDownList runat="server" ID="primaryReceiver2"> <asp:ListItem Text="True" Value="true" Enabled="false" /> <asp:ListItem Text="False" Value="false" Selected="True" /> </asp:DropDownList> </td> </tr> </table> </div> <br /> <div class="submit"> <asp:Button ID="ButtonAdaptivePayments" Text="ChainedPayment" runat="server" OnClick="ButtonAdaptivePayments_Click" /> </div> <br /> </div> <div class="showmessage"> <asp:Repeater runat="server" ID="RepeaterError"> <HeaderTemplate> <b>Error</b> </HeaderTemplate> <ItemTemplate> <ul> <li> <i> <%# Eval("message")%> </i> </li> </ul> </ItemTemplate> <FooterTemplate> <i>Please refer to the Response object for further Error information.</i> <br /> <br /> </FooterTemplate> </asp:Repeater> </div> <asp:Label runat="server" ID="LabelResponseValues" Text="Response Values" Font-Bold="true" /> <br /> <br /> <div> <asp:GridView runat="server" ID="GridViewResponseValues" AutoGenerateColumns="false"> <RowStyle BackColor="#EFF3FB" /> <AlternatingRowStyle BackColor="#FFFFFF" /> <Columns> <asp:BoundField DataField="Key" HeaderText="Key" /> <asp:BoundField DataField="Value" HeaderText="Value" /> </Columns> </asp:GridView> <br /> <asp:Label runat="server" ID="LabelConsult" Text="Please refer to the Response object for the complete list of Response Values." Font-Italic="true" /> </div> <br /> <asp:Label runat="server" ID="LabelRequest" Text="Request" Font-Bold="true" /> <br /> <br /> <asp:TextBox runat="server" ID="TextBoxRequest" TextMode="MultiLine" Rows="5" Width="95%" /> <br /> <br /> <asp:Label runat="server" ID="LabelResponse" Text="Response" Font-Bold="true" /> <br /> <br /> <asp:TextBox runat="server" ID="TextBoxResponse" TextMode="MultiLine" Rows="5" Width="95%" /> <br /> <br /> <div> <asp:Label runat="server" ID="LabelNotePaymentType" Font-Bold="true" /> <asp:Label runat="server" ID="LabelPrefixPaymentType" Font-Italic="true" /> <asp:HyperLink runat="server" ID="HyperLinkPaymentType" Font-Italic="true" /> <asp:Label runat="server" ID="LabelSuffixPaymentType" Font-Italic="true" /> </div> <div> <asp:Label runat="server" ID="LabelNoteTransactionId" Font-Bold="true" /> <asp:Label runat="server" ID="LabelPrefixTransactionId" Font-Italic="true" /> <asp:HyperLink runat="server" ID="HyperLinkTransactionId" Font-Italic="true" /> <asp:Label runat="server" ID="LabelSuffixTransactionId" Font-Italic="true" /> </div> <asp:Label runat="server" ID="LabelWebFlow" Font-Italic="true" /> <asp:HyperLink runat="server" ID="HyperLinkWebFlow" Font-Italic="true" /> <asp:Label runat="server" ID="LabelWebFlowSuffix" Font-Italic="true" /> </form> </body></html>

    Code behind.

     protected void Page_Load(object sender, EventArgs e)
            {
    
                string returnUniformResourceLocator = Request.Url.OriginalString;
                string returnAuthority = Request.Url.Authority;
                string returnDnsSafeHost = Request.Url.DnsSafeHost;
    
                if (Request.UrlReferrer != null && Request.UrlReferrer.Scheme == "https")
                {
                    returnUniformResourceLocator = returnUniformResourceLocator.Replace("http://", "https://");
                    returnUniformResourceLocator = returnUniformResourceLocator.Replace(returnAuthority, returnDnsSafeHost);
                }
    
                string cancelUniformResourceLocator = Request.Url.OriginalString;
                string cancelAuthority = Request.Url.Authority;
                string cancelDnsSafeHost = Request.Url.DnsSafeHost;
    
                if (Request.UrlReferrer != null && Request.UrlReferrer.Scheme == "https")
                {
                    cancelUniformResourceLocator = cancelUniformResourceLocator.Replace("http://", "https://");
                    cancelUniformResourceLocator = cancelUniformResourceLocator.Replace(cancelAuthority, cancelDnsSafeHost);
                }
    
                this.returnURL.Text = returnUniformResourceLocator;
                this.cancelURL.Text = cancelUniformResourceLocator;
            }
    
            protected void ButtonAdaptivePayments_Click(object sender, EventArgs e)
            {
                NameValueCollection parameters = HttpContext.Current.Request.Params;
                ReceiverList receiverList = new ReceiverList();
                receiverList.receiver = new List<Receiver>();
    
                PayRequest request = new PayRequest();
                RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");
                request.requestEnvelope = requestEnvelope;
    
                Receiver receiver1 = new Receiver();
    
                if (parameters["amount1"] != null && parameters["amount1"].Trim() != string.Empty)
                {
                    // Required) Amount to be paid to the receiver
                    receiver1.amount = Convert.ToDecimal(parameters["amount1"]);
                }
    
                if (parameters["mail1"] != null && parameters["mail1"].Trim() != string.Empty)
                {
                    // Receiver's email address. This address can be unregistered with
                    // paypal.com. If so, a receiver cannot claim the payment until a PayPal
                    // account is linked to the email address. The PayRequest must pass
                    // either an email address or a phone number. Maximum length: 127 characters
                    receiver1.email = parameters["mail1"];
                }
    
                if (parameters["primaryReceiver1"] != null && parameters["primaryReceiver1"].Trim() != string.Empty)
                {
                    receiver1.primary = Convert.ToBoolean(parameters["primaryReceiver1"]);
                }
    
                receiverList.receiver.Add(receiver1);
    
                Receiver receiver2 = new Receiver();
    
                if (parameters["amount2"] != null && parameters["amount2"].Trim() != string.Empty)
                {
                    // (Required) Amount to be paid to the receiver
                    receiver2.amount = Convert.ToDecimal(parameters["amount2"]);
                }
    
                if (parameters["mail2"] != null && parameters["mail2"].Trim() != string.Empty)
                {
                    // Receiver's email address. This address can be unregistered with
                    // paypal.com. If so, a receiver cannot claim the payment until a PayPal
                    // account is linked to the email address. The PayRequest must pass
                    // either an email address or a phone number. Maximum length: 127 characters
                    receiver2.email = parameters["mail2"];
                }
    
                if (parameters["primaryReceiver2"] != null && parameters["primaryReceiver2"].Trim() != string.Empty)
                {
                    receiver2.primary = Convert.ToBoolean(parameters["primaryReceiver2"]);
                }
    
                receiverList.receiver.Add(receiver2);
    
                ReceiverList receiverlst = new ReceiverList(receiverList.receiver);
                request.receiverList = receiverlst;
    
                // (Optional) Sender's email address. Maximum length: 127 characters
                if (parameters["senderEmail"] != null && parameters["senderEmail"].Trim() != string.Empty)
                {
                    request.senderEmail = parameters["senderEmail"];
                }
    
                // The action for this request. Possible values are: PAY – Use this
                // option if you are not using the Pay request in combination with
                // ExecutePayment. CREATE – Use this option to set up the payment
                // instructions with SetPaymentOptions and then execute the payment at a
                // later time with the ExecutePayment. PAY_PRIMARY – For chained
                // payments only, specify this value to delay payments to the secondary
                // receivers; only the payment to the primary receiver is processed.
                if (parameters["actionType"] != null && parameters["actionType"].Trim() != string.Empty)
                {
                    request.actionType = parameters["actionType"];
                }
    
                // URL to redirect the sender's browser to after canceling the approval
                // for a payment; it is always required but only used for payments that
                // require approval (explicit payments)
                if (parameters["cancelURL"] != null && parameters["cancelURL"].Trim() != string.Empty)
                {
                    request.cancelUrl = parameters["cancelURL"];
                }
    
                // The code for the currency in which the payment is made; you can
                // specify only one currency, regardless of the number of receivers
                if (parameters["currencyCode"] != null && parameters["currencyCode"].Trim() != string.Empty)
                {
                    request.currencyCode = parameters["currencyCode"];
                }
    
                // URL to redirect the sender's browser to after the sender has logged
                // into PayPal and approved a payment; it is always required but only
                // used if a payment requires explicit approval
                if (parameters["returnURL"] != null && parameters["returnURL"].Trim() != string.Empty)
                {
                    request.returnUrl = parameters["returnURL"];
                }
    
                request.requestEnvelope = requestEnvelope;
    
                // (Optional) The URL to which you want all IPN messages for this
                // payment to be sent. Maximum length: 1024 characters
                if (parameters["ipnNotificationURL"] != null && parameters["ipnNotificationURL"].Trim() != string.Empty)
                {
                    request.ipnNotificationUrl = parameters["ipnNotificationURL"];
                }
    
                AdaptivePaymentsService service = null;
                PayResponse response = null;
                try
                {
                    // Configuration map containing signature credentials and other required configuration.
                    // For a full list of configuration parameters refer in wiki page
                    // (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters)
                    Dictionary<string, string> config = new Dictionary<string, string>();
                    config.Add("mode", "sandbox");
                         // input your own information
                    config.Add("account1.apiUsername", "luan-facilitator_api1.hotmail.com");
                    config.Add("account1.apiPassword", "WNC7H73KK7QLY6CN");
                    config.Add("account1.apiSignature", "A9.v3Z12UkkZ8kOnhrv2qAmjnv2SABXeOdFqKG2Asz3RXgs6g0hpBAW1");
                    config.Add("account1.applicationId", "APP-80W284485P519543T");
                    
    
                    //< account apiUsername = "luan-facilitator_api1.hotmail.com" apiPassword = "WNC7H73KK7QLY6CN" apiSignature = "A9.v3Z12UkkZ8kOnhrv2qAmjnv2SABXeOdFqKG2Asz3RXgs6g0hpBAW1" />
    
                    // Creating service wrapper object to make an API call and loading
                    // configuration map for your credentials and endpoint
                    service = new AdaptivePaymentsService(config);
         
                    response = service.Pay(request);
                }
                catch (System.Exception ex)
                {
                    HttpContext.Current.Response.Write(ex.Message);
                    return;
                }
    
                Dictionary<string, string> responseValues = new Dictionary<string, string>();
                string redirectUrl = null;
    
                if (!response.responseEnvelope.ack.ToString().Trim().ToUpper().Equals(AckCode.FAILURE.ToString()) && !response.responseEnvelope.ack.ToString().Trim().ToUpper().Equals(AckCode.FAILUREWITHWARNING.ToString()))
                {
                    redirectUrl = "http://localhost:53239/About.aspx" + "_ap-payment&paykey=" + response.payKey;
    
                    // The pay key, which is a token you use in other Adaptive Payment APIs 
                    // (such as the Refund Method) to identify this payment. 
                    // The pay key is valid for 3 hours; the payment must be approved while the 
                    // pay key is valid. 
                    responseValues.Add("Pay Key", response.payKey);
    
                    // The status of the payment. Possible values are:
                    // CREATED – The payment request was received; funds will be transferred once the payment is approved
                    // COMPLETED – The payment was successful
                    // INCOMPLETE – Some transfers succeeded and some failed for a parallel payment or, for a delayed chained payment, secondary receivers have not been paid
                    // ERROR – The payment failed and all attempted transfers failed or all completed transfers were successfully reversed
                    // REVERSALERROR – One or more transfers failed when attempting to reverse a payment
                    // PROCESSING – The payment is in progress
                    // PENDING – The payment is awaiting processing
                    responseValues.Add("Payment Execution Status", response.paymentExecStatus);
    
                    if (response.defaultFundingPlan != null && response.defaultFundingPlan.senderFees != null)
                    {
                        // Fees to be paid by the sender
                        responseValues.Add("Sender Fees", response.defaultFundingPlan.senderFees.amount + response.defaultFundingPlan.senderFees.code);
                    }
                }
    
                responseValues.Add("Acknowledgement", response.responseEnvelope.ack.ToString().Trim().ToUpper());
    
                Display(HttpContext.Current, "ChainedPayment", "AdaptivePayments", responseValues, service.getLastRequest(), service.getLastResponse(), response.error, redirectUrl);
            }
    
            private void Display(HttpContext contextHttp, string method, string api, Dictionary<string, string> responseValues, string requestPayload, string responsePayload, List<ErrorData> errorMessages, string redirectUrl)
            {
             
    
                GridViewResponseValues.DataSource = responseValues;
                GridViewResponseValues.DataBind();
                if (errorMessages != null && errorMessages.Count > 0)
                {
                    RepeaterError.DataSource = errorMessages;
                    RepeaterError.DataBind();
                    GridViewResponseValues.HeaderStyle.BackColor = System.Drawing.Color.FromArgb(255, 0, 0);
                }
                else
                {
                    if (responseValues["Acknowledgement"].Equals(AckCode.SUCCESS.ToString()))
                    {
                        GridViewResponseValues.HeaderStyle.BackColor = System.Drawing.Color.FromArgb(0, 200, 100);
                    }
                    else
                    {
                        GridViewResponseValues.HeaderStyle.BackColor = System.Drawing.Color.FromArgb(255, 255, 0);
                    }
                    if (redirectUrl != null)
                    {
                        LabelWebFlow.Text = "This API has Web Flow to redirect the user to complete the API call, please click the hyperlink to redirect the user to ";
                        HyperLinkWebFlow.Text = redirectUrl;
                        HyperLinkWebFlow.NavigateUrl = redirectUrl;
                        LabelWebFlowSuffix.Text = ".<br/><br/>";
                    }
                }
    
                requestPayload = HttpUtility.UrlDecode(requestPayload);
                responsePayload = HttpUtility.UrlDecode(responsePayload);
    
                TextBoxRequest.Text = requestPayload;
                TextBoxResponse.Text = responsePayload;
            }

    If the request is successful, you should see the image below.

    Then you could copy the paykey to the url   https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=[your pay key] and it will send you to the payment page.

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 19, 2019 9:45 AM
  • User-893317190 posted

    Hi sky_091006@hotmail.com,

    Your request should be of type PayDetailsRequest not PayRequest .

    Below is my code.

     protected void Button1_Click(object sender, EventArgs e)
            {
    
                ReceiverList receiverList = new ReceiverList();
                receiverList.receiver = new List<Receiver>();
                PaymentDetailsRequest request = new PaymentDetailsRequest(new RequestEnvelope("en_US"));
                RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");
                request.requestEnvelope = requestEnvelope;
                request.payKey = TextBox1.Text;   -- input your payKey
                AdaptivePaymentsService service = null;
                PaymentDetailsResponse response = null;
                // Configuration map containing signature credentials and other required configuration.
                // For a full list of configuration parameters refer in wiki page
                // (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters)
                Dictionary<string, string> config = new Dictionary<string, string>();
              
                config.Add("mode", "sandbox");
    
               // input your own information
    config.Add("account1.apiUsername", "...");
    config.Add("account1.apiPassword", "...");
    config.Add("account1.apiSignature", "...");
    config.Add("account1.applicationId", "APP-80W284485P519543T"); service = new AdaptivePaymentsService(config); response = service.PaymentDetails(request); PaymentInfo info = response.paymentInfoList.paymentInfo[0]; //--loop through the paymentInfo to get all the transactionId Response.Write("<br/>"); foreach (var item in response.paymentInfoList.paymentInfo) { Response.Write("receiver:" + item.receiver.accountId + "&nbsp;&nbsp;&nbsp;" + "transactionId:" + item.transactionId + "&nbsp;&nbsp;&nbsp;"+"senderTransactionid:"+item.senderTransactionId); Response.Write("<br/>"); } }

    The result.

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 28, 2019 8:57 AM

All replies

  • User-893317190 posted

    Hi sky_091006@hotmail.com,

    Have you tried  sdk of paypal for c#?

    This two aspx deals with chainded payment.

    https://github.com/paypal/adaptivepayments-sdk-dotnet/blob/master/Samples/AdaptivePaymentsSampleApp/UseCaseSamples/ChainedPayment.aspx

    https://github.com/paypal/adaptivepayments-sdk-dotnet/blob/master/Samples/AdaptivePaymentsSampleApp/UseCaseSamples/RequestResponse.aspx.cs

    Please download the sdk through nuget. Just Search for PayPalCoreSDK.

    Below is a small sample.

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style>
            body {
    	
    }
    
    table th {
    	font-weight: normal;	
    }
    
    #permissionsdata {
    	margin-top: 20px;
    }
    
    #permissionsdata td {
    	padding: 10px 20px;
    }
    
    #permissionsdata td.left {
    	border-right: solid 1px gray;
    }
    
    .overview {
    	padding: 10px 20px;
    	font-style: italic;
    	width: 75%;
    }
    
    input.smallfield, select.smallfield {
    	width: 105px;
    	font-size: 12px;
    }
    
    input.xsmallfield, select.xsmallfield {
    	width: 75px;
    	font-size: 12px;
    }
    
    .open {
    	display: block;
    }
    
    .closed {
    	display: none;
    }
    
    #apidetails {
    	padding: 10px 20px 30px 20px;
    	font-style: italic;
    	width: 75%;
    }
    
    .note {
    	margin: 10px 10px;
    	font-style: italic;
    }
    
    .section_header {
    	margin: 20px 0px;
    	font-weight: bold;
    }
    
    .submit {
    	margin-top: 20px;
    	margin-bottom: 20px;
    }
    
    ul.wizard {
    	font-size: 16px;
    	color: gray;
    	list-style-type: none;
    }
    
    ul.wizard li {
    	width: 20%;
    }
    
    ul.wizard li.current {
    	color: black;
    	font-weight: bold;
    }
    
    ul.wizard li.complete {
    	color: black;
    	background-image: url(images/tick.png);
    	background-repeat: no-repeat;
    	background- right;
    	padding-right: 50px;
    }
        </style>
        <script src="../Scripts/jquery-3.3.1.js"></script>
    <!--you could get the js in the gidhub address for .net sdk--> <script src="sdk_functions.js"></script> </head> <body> <div id="wrapper"> <div id="header"> <h3>Chained Payment</h3> <div id="apidetails"> <p> <i>A Chained Payment is a Payment from a sender that is indirectly split among multiple receivers. It is an extension of a typical Payment from a sender to a receiver, in which a receiver, known as the Primary Receiver, passes part of the Payment to other Receivers, who are called Secondary Receivers. Create your PayRequest message by setting the common fields. If you want more than a Simple Payment, add fields for the specific kind of request, which include Parallel Payments, Chained Payments, Implicit Payments, and Preapproved Payments. </i> </p> </div> </div> </div> <form id="form1" runat="server"> <div id="request_form"> <div class="params"> <div class="param_name"> Currency Code*</div> <div class="param_value"> <asp:TextBox runat="server" ID="currencyCode" Text="USD" /> </div> <div class="param_name"> Action Type*</div> <div class="param_value"> <asp:DropDownList runat="server" ID="actionType"> <asp:ListItem Text="Pay" Value="PAY" Enabled="True" Selected="True" /> <asp:ListItem Text="Pay Primary" Value="PAY_PRIMARY" /> <asp:ListItem Text="Create" Value="CREATE" Enabled="false" /> </asp:DropDownList> </div> <div class="param_name"> Cancel URL*</div> <div class="param_value"> <asp:TextBox runat="server" ID="cancelURL" /> </div> <div class="param_name"> Return URL*</div> <div class="param_value"> <asp:TextBox runat="server" ID="returnURL" /> </div> <div class="param_name"> IPN Notification URL (For receiving IPN call back from PayPal) </div> <div class="param_value"> <asp:TextBox runat="server" ID="ipnNotificationURL" /> </div> <div class="param_name"> Sender Email </div> <div class="param_value">
    <!-- input your sender--> <asp:TextBox runat="server" ID="senderEmail" Text="v-acxu-buyer@hotmail.com" /> </div> <div class="section_header"> Receiver </div> <div class="note"> <i>Receiver is the party where funds are transferred to. A Primary Receiver receives a Payment directly from the sender in a Chained Split Payment. A Primary Receiver should not be specified when making a single or Parallel Split Payment. At most one Receiver can be set as Primary Receiver. </i> </div> <table> <tr> <th class="param_name"> Amount* </th> <th class="param_name"> Email* </th> <th> Primary Receiver </th> </tr> <tr> <td class="param_value"> <asp:TextBox runat="server" ID="amount1" Text="3.00" /> </td> <td class="param_value">
    <!--input the first receiver--> <asp:TextBox runat="server" ID="mail1" Text="v-acxu-facilitator@hotmail.com" /> </td> <td> <asp:DropDownList runat="server" ID="primaryReceiver1"> <asp:ListItem Text="True" Value="true" Selected="True" /> <asp:ListItem Text="False" Value="false" Enabled="false" /> </asp:DropDownList> </td> </tr> <tr> <td class="param_value">
    <!--input the second receiver--> <asp:TextBox runat="server" ID="amount2" Text="2.00" /> </td> <td class="param_value"> <asp:TextBox runat="server" ID="mail2" Text="luan-facilitator@hotmail.com" /> </td> <td> <asp:DropDownList runat="server" ID="primaryReceiver2"> <asp:ListItem Text="True" Value="true" Enabled="false" /> <asp:ListItem Text="False" Value="false" Selected="True" /> </asp:DropDownList> </td> </tr> </table> </div> <br /> <div class="submit"> <asp:Button ID="ButtonAdaptivePayments" Text="ChainedPayment" runat="server" OnClick="ButtonAdaptivePayments_Click" /> </div> <br /> </div> <div class="showmessage"> <asp:Repeater runat="server" ID="RepeaterError"> <HeaderTemplate> <b>Error</b> </HeaderTemplate> <ItemTemplate> <ul> <li> <i> <%# Eval("message")%> </i> </li> </ul> </ItemTemplate> <FooterTemplate> <i>Please refer to the Response object for further Error information.</i> <br /> <br /> </FooterTemplate> </asp:Repeater> </div> <asp:Label runat="server" ID="LabelResponseValues" Text="Response Values" Font-Bold="true" /> <br /> <br /> <div> <asp:GridView runat="server" ID="GridViewResponseValues" AutoGenerateColumns="false"> <RowStyle BackColor="#EFF3FB" /> <AlternatingRowStyle BackColor="#FFFFFF" /> <Columns> <asp:BoundField DataField="Key" HeaderText="Key" /> <asp:BoundField DataField="Value" HeaderText="Value" /> </Columns> </asp:GridView> <br /> <asp:Label runat="server" ID="LabelConsult" Text="Please refer to the Response object for the complete list of Response Values." Font-Italic="true" /> </div> <br /> <asp:Label runat="server" ID="LabelRequest" Text="Request" Font-Bold="true" /> <br /> <br /> <asp:TextBox runat="server" ID="TextBoxRequest" TextMode="MultiLine" Rows="5" Width="95%" /> <br /> <br /> <asp:Label runat="server" ID="LabelResponse" Text="Response" Font-Bold="true" /> <br /> <br /> <asp:TextBox runat="server" ID="TextBoxResponse" TextMode="MultiLine" Rows="5" Width="95%" /> <br /> <br /> <div> <asp:Label runat="server" ID="LabelNotePaymentType" Font-Bold="true" /> <asp:Label runat="server" ID="LabelPrefixPaymentType" Font-Italic="true" /> <asp:HyperLink runat="server" ID="HyperLinkPaymentType" Font-Italic="true" /> <asp:Label runat="server" ID="LabelSuffixPaymentType" Font-Italic="true" /> </div> <div> <asp:Label runat="server" ID="LabelNoteTransactionId" Font-Bold="true" /> <asp:Label runat="server" ID="LabelPrefixTransactionId" Font-Italic="true" /> <asp:HyperLink runat="server" ID="HyperLinkTransactionId" Font-Italic="true" /> <asp:Label runat="server" ID="LabelSuffixTransactionId" Font-Italic="true" /> </div> <asp:Label runat="server" ID="LabelWebFlow" Font-Italic="true" /> <asp:HyperLink runat="server" ID="HyperLinkWebFlow" Font-Italic="true" /> <asp:Label runat="server" ID="LabelWebFlowSuffix" Font-Italic="true" /> </form> </body></html>

    Code behind.

     protected void Page_Load(object sender, EventArgs e)
            {
    
                string returnUniformResourceLocator = Request.Url.OriginalString;
                string returnAuthority = Request.Url.Authority;
                string returnDnsSafeHost = Request.Url.DnsSafeHost;
    
                if (Request.UrlReferrer != null && Request.UrlReferrer.Scheme == "https")
                {
                    returnUniformResourceLocator = returnUniformResourceLocator.Replace("http://", "https://");
                    returnUniformResourceLocator = returnUniformResourceLocator.Replace(returnAuthority, returnDnsSafeHost);
                }
    
                string cancelUniformResourceLocator = Request.Url.OriginalString;
                string cancelAuthority = Request.Url.Authority;
                string cancelDnsSafeHost = Request.Url.DnsSafeHost;
    
                if (Request.UrlReferrer != null && Request.UrlReferrer.Scheme == "https")
                {
                    cancelUniformResourceLocator = cancelUniformResourceLocator.Replace("http://", "https://");
                    cancelUniformResourceLocator = cancelUniformResourceLocator.Replace(cancelAuthority, cancelDnsSafeHost);
                }
    
                this.returnURL.Text = returnUniformResourceLocator;
                this.cancelURL.Text = cancelUniformResourceLocator;
            }
    
            protected void ButtonAdaptivePayments_Click(object sender, EventArgs e)
            {
                NameValueCollection parameters = HttpContext.Current.Request.Params;
                ReceiverList receiverList = new ReceiverList();
                receiverList.receiver = new List<Receiver>();
    
                PayRequest request = new PayRequest();
                RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");
                request.requestEnvelope = requestEnvelope;
    
                Receiver receiver1 = new Receiver();
    
                if (parameters["amount1"] != null && parameters["amount1"].Trim() != string.Empty)
                {
                    // Required) Amount to be paid to the receiver
                    receiver1.amount = Convert.ToDecimal(parameters["amount1"]);
                }
    
                if (parameters["mail1"] != null && parameters["mail1"].Trim() != string.Empty)
                {
                    // Receiver's email address. This address can be unregistered with
                    // paypal.com. If so, a receiver cannot claim the payment until a PayPal
                    // account is linked to the email address. The PayRequest must pass
                    // either an email address or a phone number. Maximum length: 127 characters
                    receiver1.email = parameters["mail1"];
                }
    
                if (parameters["primaryReceiver1"] != null && parameters["primaryReceiver1"].Trim() != string.Empty)
                {
                    receiver1.primary = Convert.ToBoolean(parameters["primaryReceiver1"]);
                }
    
                receiverList.receiver.Add(receiver1);
    
                Receiver receiver2 = new Receiver();
    
                if (parameters["amount2"] != null && parameters["amount2"].Trim() != string.Empty)
                {
                    // (Required) Amount to be paid to the receiver
                    receiver2.amount = Convert.ToDecimal(parameters["amount2"]);
                }
    
                if (parameters["mail2"] != null && parameters["mail2"].Trim() != string.Empty)
                {
                    // Receiver's email address. This address can be unregistered with
                    // paypal.com. If so, a receiver cannot claim the payment until a PayPal
                    // account is linked to the email address. The PayRequest must pass
                    // either an email address or a phone number. Maximum length: 127 characters
                    receiver2.email = parameters["mail2"];
                }
    
                if (parameters["primaryReceiver2"] != null && parameters["primaryReceiver2"].Trim() != string.Empty)
                {
                    receiver2.primary = Convert.ToBoolean(parameters["primaryReceiver2"]);
                }
    
                receiverList.receiver.Add(receiver2);
    
                ReceiverList receiverlst = new ReceiverList(receiverList.receiver);
                request.receiverList = receiverlst;
    
                // (Optional) Sender's email address. Maximum length: 127 characters
                if (parameters["senderEmail"] != null && parameters["senderEmail"].Trim() != string.Empty)
                {
                    request.senderEmail = parameters["senderEmail"];
                }
    
                // The action for this request. Possible values are: PAY – Use this
                // option if you are not using the Pay request in combination with
                // ExecutePayment. CREATE – Use this option to set up the payment
                // instructions with SetPaymentOptions and then execute the payment at a
                // later time with the ExecutePayment. PAY_PRIMARY – For chained
                // payments only, specify this value to delay payments to the secondary
                // receivers; only the payment to the primary receiver is processed.
                if (parameters["actionType"] != null && parameters["actionType"].Trim() != string.Empty)
                {
                    request.actionType = parameters["actionType"];
                }
    
                // URL to redirect the sender's browser to after canceling the approval
                // for a payment; it is always required but only used for payments that
                // require approval (explicit payments)
                if (parameters["cancelURL"] != null && parameters["cancelURL"].Trim() != string.Empty)
                {
                    request.cancelUrl = parameters["cancelURL"];
                }
    
                // The code for the currency in which the payment is made; you can
                // specify only one currency, regardless of the number of receivers
                if (parameters["currencyCode"] != null && parameters["currencyCode"].Trim() != string.Empty)
                {
                    request.currencyCode = parameters["currencyCode"];
                }
    
                // URL to redirect the sender's browser to after the sender has logged
                // into PayPal and approved a payment; it is always required but only
                // used if a payment requires explicit approval
                if (parameters["returnURL"] != null && parameters["returnURL"].Trim() != string.Empty)
                {
                    request.returnUrl = parameters["returnURL"];
                }
    
                request.requestEnvelope = requestEnvelope;
    
                // (Optional) The URL to which you want all IPN messages for this
                // payment to be sent. Maximum length: 1024 characters
                if (parameters["ipnNotificationURL"] != null && parameters["ipnNotificationURL"].Trim() != string.Empty)
                {
                    request.ipnNotificationUrl = parameters["ipnNotificationURL"];
                }
    
                AdaptivePaymentsService service = null;
                PayResponse response = null;
                try
                {
                    // Configuration map containing signature credentials and other required configuration.
                    // For a full list of configuration parameters refer in wiki page
                    // (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters)
                    Dictionary<string, string> config = new Dictionary<string, string>();
                    config.Add("mode", "sandbox");
                         // input your own information
                    config.Add("account1.apiUsername", "luan-facilitator_api1.hotmail.com");
                    config.Add("account1.apiPassword", "WNC7H73KK7QLY6CN");
                    config.Add("account1.apiSignature", "A9.v3Z12UkkZ8kOnhrv2qAmjnv2SABXeOdFqKG2Asz3RXgs6g0hpBAW1");
                    config.Add("account1.applicationId", "APP-80W284485P519543T");
                    
    
                    //< account apiUsername = "luan-facilitator_api1.hotmail.com" apiPassword = "WNC7H73KK7QLY6CN" apiSignature = "A9.v3Z12UkkZ8kOnhrv2qAmjnv2SABXeOdFqKG2Asz3RXgs6g0hpBAW1" />
    
                    // Creating service wrapper object to make an API call and loading
                    // configuration map for your credentials and endpoint
                    service = new AdaptivePaymentsService(config);
         
                    response = service.Pay(request);
                }
                catch (System.Exception ex)
                {
                    HttpContext.Current.Response.Write(ex.Message);
                    return;
                }
    
                Dictionary<string, string> responseValues = new Dictionary<string, string>();
                string redirectUrl = null;
    
                if (!response.responseEnvelope.ack.ToString().Trim().ToUpper().Equals(AckCode.FAILURE.ToString()) && !response.responseEnvelope.ack.ToString().Trim().ToUpper().Equals(AckCode.FAILUREWITHWARNING.ToString()))
                {
                    redirectUrl = "http://localhost:53239/About.aspx" + "_ap-payment&paykey=" + response.payKey;
    
                    // The pay key, which is a token you use in other Adaptive Payment APIs 
                    // (such as the Refund Method) to identify this payment. 
                    // The pay key is valid for 3 hours; the payment must be approved while the 
                    // pay key is valid. 
                    responseValues.Add("Pay Key", response.payKey);
    
                    // The status of the payment. Possible values are:
                    // CREATED – The payment request was received; funds will be transferred once the payment is approved
                    // COMPLETED – The payment was successful
                    // INCOMPLETE – Some transfers succeeded and some failed for a parallel payment or, for a delayed chained payment, secondary receivers have not been paid
                    // ERROR – The payment failed and all attempted transfers failed or all completed transfers were successfully reversed
                    // REVERSALERROR – One or more transfers failed when attempting to reverse a payment
                    // PROCESSING – The payment is in progress
                    // PENDING – The payment is awaiting processing
                    responseValues.Add("Payment Execution Status", response.paymentExecStatus);
    
                    if (response.defaultFundingPlan != null && response.defaultFundingPlan.senderFees != null)
                    {
                        // Fees to be paid by the sender
                        responseValues.Add("Sender Fees", response.defaultFundingPlan.senderFees.amount + response.defaultFundingPlan.senderFees.code);
                    }
                }
    
                responseValues.Add("Acknowledgement", response.responseEnvelope.ack.ToString().Trim().ToUpper());
    
                Display(HttpContext.Current, "ChainedPayment", "AdaptivePayments", responseValues, service.getLastRequest(), service.getLastResponse(), response.error, redirectUrl);
            }
    
            private void Display(HttpContext contextHttp, string method, string api, Dictionary<string, string> responseValues, string requestPayload, string responsePayload, List<ErrorData> errorMessages, string redirectUrl)
            {
             
    
                GridViewResponseValues.DataSource = responseValues;
                GridViewResponseValues.DataBind();
                if (errorMessages != null && errorMessages.Count > 0)
                {
                    RepeaterError.DataSource = errorMessages;
                    RepeaterError.DataBind();
                    GridViewResponseValues.HeaderStyle.BackColor = System.Drawing.Color.FromArgb(255, 0, 0);
                }
                else
                {
                    if (responseValues["Acknowledgement"].Equals(AckCode.SUCCESS.ToString()))
                    {
                        GridViewResponseValues.HeaderStyle.BackColor = System.Drawing.Color.FromArgb(0, 200, 100);
                    }
                    else
                    {
                        GridViewResponseValues.HeaderStyle.BackColor = System.Drawing.Color.FromArgb(255, 255, 0);
                    }
                    if (redirectUrl != null)
                    {
                        LabelWebFlow.Text = "This API has Web Flow to redirect the user to complete the API call, please click the hyperlink to redirect the user to ";
                        HyperLinkWebFlow.Text = redirectUrl;
                        HyperLinkWebFlow.NavigateUrl = redirectUrl;
                        LabelWebFlowSuffix.Text = ".<br/><br/>";
                    }
                }
    
                requestPayload = HttpUtility.UrlDecode(requestPayload);
                responsePayload = HttpUtility.UrlDecode(responsePayload);
    
                TextBoxRequest.Text = requestPayload;
                TextBoxResponse.Text = responsePayload;
            }

    If the request is successful, you should see the image below.

    Then you could copy the paykey to the url   https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=[your pay key] and it will send you to the payment page.

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 19, 2019 9:45 AM
  • User-1121304814 posted

    Hi Ackerly Xu,

    Thank for the guide and effort i will go have a try and let you know.

    Wednesday, February 20, 2019 8:46 AM
  • User-1121304814 posted

    Hi Ackerly Xu,

    I have try the SDK,

    i have a few question

    1) what is the max Receiver i can add?

    2) how to redirect to paypal API with credit card information key-in on my site and send to Paypal API and get transaction number after success? .

    Best regards,

    Caleb

    Wednesday, February 20, 2019 1:24 PM
  • User-893317190 posted

    Hi Caleb,

    I think only if your have given the  main receiver enough money , it could  dispatch to other receivers according to the receivers you have added.

    As to the max receiver , I haven't found in the docs, I think you could go to their forum to have a check. https://developer.paypal.com/support/

    If you want to redirect your customer, after your get the paykey

                if (!response.responseEnvelope.ack.ToString().Trim().ToUpper().Equals(AckCode.FAILURE.ToString()) && !response.responseEnvelope.ack.ToString().Trim().ToUpper().Equals(AckCode.FAILUREWITHWARNING.ToString()))
                {
                    
                          //here you get the payKey after sending the request and have confirmed the request has a success
                   string mypayKey = response.payKey
    
                }
    

    Just use the paykey to redirect the customer.Write 

    Response.Redirect("https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_ap-payment&paykey=[your pay key]" )

    If you are using mvc ,please use return Redirect().

    If you want to query the result, please refer to the sdk's  PaymentDetails options,  it is in https://github.com/paypal/adaptivepayments-sdk-dotnet/blob/master/Samples/AdaptivePaymentsSampleApp/PaymentDetails.aspx  and  https://github.com/paypal/adaptivepayments-sdk-dotnet/blob/master/Samples/AdaptivePaymentsSampleApp/AdaptivePaymentsHandler.ashx.cs

    input your paykey and use the sdk's sample to have a try.

    Best regards,

    Ackerly Xu

    Thursday, February 21, 2019 1:38 AM
  • User-1121304814 posted

    Hi Ackerly Xu,

    Thank For the clear explanation,

    my last question is there anyway to use credit card payment method in the client side together with adaptive payments method and redirect to paypal to process the payment?

    i saw in the github https://github.com/paypal/PayPal-NET-SDK/blob/develop/Source/SDK/Api/CreditCard.cs there is Credit card method but how am i going to implement this to the current code right now.

    Best regards,

    Caleb

    Thursday, February 21, 2019 12:09 PM
  • User-893317190 posted

    Hi sky_091006@hotmail.com,

    Not clear about credit pay , but you could change the pay way in the payment page. Please click the change link

    After click the link , add credit card should appear on the right.

    But I have met a problem , when adding credit card, say the credit card belongs to another

    I am in sandbox and the account truly has the credit card, I am not sure whether it appears,does  my account need to configure further? 

    I think you had better  refer to their forum for helo , if you also meet the problem. https://developer.paypal.com/support/

    Best regards,

    Ackerly Xu

    Friday, February 22, 2019 1:46 AM
  • User-1121304814 posted

    Hi Ackerly Xu,

    i also have the same issue with this when using the credit card function.

    i try on the new card it works in the first try but on the second try it get the same error as you.

    i even try to call them they said the card have bind to the account when there is no account at all.

    Best regards,

    Caleb

    Friday, February 22, 2019 4:43 PM
  • User-1121304814 posted

    Hi Ackerly Xu

    is there anyway to get the transaction number from paypal using the PayKey?

    cause i need the transaction number to save in database.

    Best regards,

    Caleb

    Saturday, February 23, 2019 10:47 AM
  • User-893317190 posted

    Hi sky_091006@hotmail.com,

    If you have seen the document for PaymentDetails , you could see transactionId in PaymentInfo fields

    https://developer.paypal.com/docs/classic/api/adaptive-payments/PaymentDetails_API_Operation/#paymentinfo-fields

    The sdk has corresponding property.

    https://github.com/paypal/adaptivepayments-sdk-dotnet/blob/master/Samples/AdaptivePaymentsSampleApp/AdaptivePaymentsHandler.ashx.cs

    You could see  the code below in PaymentDetails method.

     PaymentDetailsResponse response = null;
    
                try
    
                {
    
                    // Configuration map containing signature credentials and other required configuration.
    
                    // For a full list of configuration parameters refer in wiki page 
    
                    // (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters)
    
                    Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
    
    
    
                    // Creating service wrapper object to make an API call and loading
    
                    // configuration map for your credentials and endpoint
    
                    service = new AdaptivePaymentsService(configurationMap);
    
                    response = service.PaymentDetails(request);
    
                }

    Here you get the response of type PaymentDetailsResponse .

    You could get the transactionId through PaymentDetailsResponse.

     
                PaymentInfo info = response.paymentInfoList.paymentInfo[0]; --loop through the paymentInfo to get all the transactionId
                string senderId = info.senderTransactionId;
               string transactionId = info.transactionId;

    Best regards,

    Ackerly Xu

    Monday, February 25, 2019 7:07 AM
  • User-1121304814 posted

    Hi Ackerly Xu,

    I have try but it didn't work maybe i have done something wrong i put it on the page_load

    here the code

    try
    {
    NameValueCollection parameters = HttpContext.Current.Request.Params;
    ReceiverList receiverList = new ReceiverList();
    receiverList.receiver = new List<Receiver>();

    PayRequest request = new PayRequest();
    RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");
    request.requestEnvelope = requestEnvelope;

    AdaptivePaymentsService service = null;
    PaymentDetailsResponse response = null;

    // Configuration map containing signature credentials and other required configuration.
    // For a full list of configuration parameters refer in wiki page
    // (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters)
    Dictionary<string, string> config = new Dictionary<string, string>();
    config.Add("mode", "sandbox");
    // input your own information
    config.Add("account1.apiUsername", "...");
    config.Add("account1.apiPassword", "...");
    config.Add("account1.apiSignature", "...");
    config.Add("account1.applicationId", "APP-80W284485P519543T");


    service = new AdaptivePaymentsService(config);

    response = service.PaymentDetails(request);

    PaymentInfo info = response.paymentInfoList.paymentInfo[0]; //--loop through the paymentInfo to get all the transactionId
    string senderId = info.senderTransactionId;
    string transactionId = info.transactionId;

    var teststring = senderId + " : " + transactionId;
    }
    catch (System.Exception ex)
    {
    HttpContext.Current.Response.Write(ex.Message);
    return;
    }

    **response = service.PaymentDetails(request); <-- is give red underline

    cannot convert from 'PayPal.AdaptivePayments.Model.Payrequest' to 'PayPal.AdaptivePayments.Model.PaymentDetailsRequest'

    hope you can help me up with this thank a lot.

    Best regards

    Caleb

    Wednesday, February 27, 2019 1:48 PM
  • User-893317190 posted

    Hi sky_091006@hotmail.com,

    Your request should be of type PayDetailsRequest not PayRequest .

    Below is my code.

     protected void Button1_Click(object sender, EventArgs e)
            {
    
                ReceiverList receiverList = new ReceiverList();
                receiverList.receiver = new List<Receiver>();
                PaymentDetailsRequest request = new PaymentDetailsRequest(new RequestEnvelope("en_US"));
                RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");
                request.requestEnvelope = requestEnvelope;
                request.payKey = TextBox1.Text;   -- input your payKey
                AdaptivePaymentsService service = null;
                PaymentDetailsResponse response = null;
                // Configuration map containing signature credentials and other required configuration.
                // For a full list of configuration parameters refer in wiki page
                // (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters)
                Dictionary<string, string> config = new Dictionary<string, string>();
              
                config.Add("mode", "sandbox");
    
               // input your own information
    config.Add("account1.apiUsername", "...");
    config.Add("account1.apiPassword", "...");
    config.Add("account1.apiSignature", "...");
    config.Add("account1.applicationId", "APP-80W284485P519543T"); service = new AdaptivePaymentsService(config); response = service.PaymentDetails(request); PaymentInfo info = response.paymentInfoList.paymentInfo[0]; //--loop through the paymentInfo to get all the transactionId Response.Write("<br/>"); foreach (var item in response.paymentInfoList.paymentInfo) { Response.Write("receiver:" + item.receiver.accountId + "&nbsp;&nbsp;&nbsp;" + "transactionId:" + item.transactionId + "&nbsp;&nbsp;&nbsp;"+"senderTransactionid:"+item.senderTransactionId); Response.Write("<br/>"); } }

    The result.

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 28, 2019 8:57 AM
  • User-1121304814 posted

    Hi Ackerly Xu

    Thank a lot from your help and patience to guiding me all the way here.

    Thank you

    Best regards,

    Caleb

    Thursday, February 28, 2019 1:46 PM