Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
How can I allow a user to pay with PayPal while using the BVC web service?
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
The API alone isn't enough to integrate PayPal into your application. The reason is because your application will need to exchange data with PayPal and then use the API to send that data to BV Commerce. |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
I realize that, sorry I didn't provide more information.
What do I need to do in the BVC API to facilitate this?
These are the steps from PayPal to verify a payment using their mobile SDK: Your app makes a successful payment with a PayPal Mobile SDK. Your app sends data about the payment to your server Your server can store the payment id value in a database. From your server, you use the payment id value to look up the payment details with the REST API. You verify the payment details, as described below.
Once I've verified the payment on the server. How do I proceed with BVC?
Thanks!
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Store the accepted token in the ThirdPartyOrderId property of the Order object. This is used to authorize and capture the funds later. We also store the PayerID value in a CustomProperty in the Order object (devId = "bvsoftware", key = "PayerID"). Next you'll need to add the PayPal payment (OrderPayment object) to the order. Below is a snippet of code showing what the OrderPayment object should look like: Code:
Orders.OrderPayment p = new Orders.OrderPayment();
p.OrderID = o.Bvin;
p.AuditDate = DateTime.Now;
p.PaymentMethodName = "Paypal Express";
p.PaymentMethodId = "33eeba60-e5b7-4864-9b57-3f8d614f8301";
// you'll also need to add the PayerID as a CustomProperty to this object as well
Once this data is all stored you can run the "Process New Order" workflow as discussed previously. Edited by user Monday, January 12, 2015 5:58:30 PM(UTC)
| Reason: Not specified |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
This is the data provided by the mobile SDK: { client = { environment = mock; "paypal_sdk_version" = "2.8.1"; platform = iOS; "product_name" = "PayPal iOS SDK"; }; response = { "create_time" = "2015-01-13T21:49:54Z"; id = "PAY-NONETWORKPAYIDEXAMPLE123"; intent = sale; state = approved; }; "response_type" = payment; }
Is the "id" the token that gets stored in ThirdPartOrderId?
Can the payment be processed by BVC with just this information? Or do I need to poll PayPal's REST service for more payment information?
What is the PayerID?
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Originally Posted by: tappedtech Is the "id" the token that gets stored in ThirdPartOrderId? It's a little difficult to tell because they're not using a 'real' value in their code sample, but my guess is yes. Originally Posted by: tappedtech Can the payment be processed by BVC with just this information? Yes, provided that you also get the PayerID as noted below. Originally Posted by: tappedtech What is the PayerID? PayPal should give you the PayerID after the customer has come back to your application from PayPal. |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
Originally Posted by: Aaron PayPal should give you the PayerID after the customer has come back to your application from PayPal. Do you know if the PayerID is the username or is it some other identifier? The JSON information I posted earlier is all I get back from the mobile SDK. I'll try and see if their REST service provides more details.
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Originally Posted by: tappedtech Originally Posted by: Aaron PayPal should give you the PayerID after the customer has come back to your application from PayPal. Do you know if the PayerID is the username or is it some other identifier? No, the PayerID isn't the username (or at least it's not the user name in plain text). Looking at a few examples they are pretty much all capital letters (approximately 13 characters long) and some have a number mixed in. |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
|
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
I was able to get the payerId by querying PayPal's REST API.
Could you please confirm this is how I should be adding the custom property and adding the payment to the order:
ws.Orders_Order_CustomPropertySet(ref token, order, "bvsoftware", "PayerID", payerId);
order = ws.Orders_Order_FindByBvin(ref token, orderBvin.ToString()); WebServices3.OrderPayment payment = new WebServices3.OrderPayment(); payment.OrderID = order.Bvin; payment.ThirdPartyOrderId = paymentToken; payment.PaymentMethodId = "33eeba60-e5b7-4864-9b57-3f8d614f8301"; payment.PaymentMethodName = "Paypal Express";
ws.Orders_Order_AddPayment(ref token, order, payment);
|
|
|
|
Rank: Administration
Joined: 4/2/2004(UTC) Posts: 2,393 Location: Hummelstown, PA Thanks: 6 times Was thanked: 163 time(s) in 158 post(s)
|
Originally Posted by: tappedtech I was able to get the payerId by querying PayPal's REST API. Great! Originally Posted by: tappedtech Could you please confirm this is how I should be adding the custom property and adding the payment to the order:
ws.Orders_Order_CustomPropertySet(ref token, order, "bvsoftware", "PayerID", payerId); There's a bug in the CustomProperty web service insert/update calls that prevent this from working properly. You will need to manually set the CustomProperty array of the object that you're working with (the Order object, in this case) and then update that. |
Aaron Sherrick BV Commerce Toll-free 888-665-8637 - Int'l +1 717-220-0012 |
|
|
|
Rank: Member
Joined: 11/21/2014(UTC) Posts: 66
|
Thanks. I'll update the order's custom property manually.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.