Tuesday, 27 August 2013

PayPal - Payment Summery doesn't show items set by SetPaymentOptions

PayPal - Payment Summery doesn't show items set by SetPaymentOptions

I'm working with Adaptive Payments using PayPal SDK for .Net. I'm trying
to use SetPaymentOptions method to set the items I wish to display in the
Payment Summary section, however, when I redirect the site to the sandbox
approval page using the pay key I received from the Pay method, the
payment summary only shows one row that says "faciliator account's Test
Store" and the total amount.
The response returns a success code, plus I see that other parameters,
such as BuisnessName (in DisplayOptions) are showing up on the page.
Following is the code I'm trying to execute (the parameters are replaced
by real values that map to actual accounts, urls, amounts, etc.). Can
anybody tell me what I'm doing wrong?
Thanks!
AdaptivePaymentsService service = new AdaptivePaymentsService();
RequestEnvelope envelopeRequest = new RequestEnvelope();
envelopeRequest.errorLanguage = "en_US";
List<Receiver> listReceiver = new List<Receiver>();
Receiver receive = new Receiver((decimal)300.15);
receive.email = "receiver@mail.com";
listReceiver.Add(receive);
ReceiverList listOfReceivers = new ReceiverList(listReceiver);
PayRequest reqPay = new PayRequest(envelopeRequest, "CREATE", "url",
"USD", listOfReceivers, "url");
reqPay.sender = new SenderIdentifier();
reqPay.sender.email = "sender@mail.com";
PayResponse responsePay = service.Pay(reqPay);
if (responsePay != null &&
responsePay.responseEnvelope.ack.ToString().Trim().ToUpper().Equals("SUCCESS"))
{
SetPaymentOptionsRequest payOptionsReq = new
SetPaymentOptionsRequest();
payOptionsReq.displayOptions = new DisplayOptions()
{
businessName = "My business name"
};
payOptionsReq.payKey = responsePay.payKey;
payOptionsReq.requestEnvelope = envelopeRequest;
payOptionsReq.receiverOptions = new List<ReceiverOptions>()
{
new ReceiverOptions()
{
receiver = new ReceiverIdentifier()
{
email = "receiver@mail.com"
},
description = "invoice test",
invoiceData = new InvoiceData()
{
item = new List<InvoiceItem>()
{
new InvoiceItem()
{
identifier = "1",
itemCount = 2,
itemPrice = (decimal)100.0,
name = "test",
price = (decimal)150.0
},
new InvoiceItem()
{
identifier = "2",
itemCount = 1,
itemPrice = (decimal)100.0,
name = "test2",
price = (decimal)150.15
}
},
totalShipping = 0,
totalTax = 0
}
}
};
SetPaymentOptionsResponse r =
service.SetPaymentOptions(payOptionsReq);
// ....
}

No comments:

Post a Comment