peskywinnets
Registered User.
- Local time
- Today, 15:01
- Joined
- Feb 4, 2014
- Messages
- 578
So I've just come up against a 'gotcha'...namely an Ebay supplied shipping address can differ from the Paypal shipping address...I need to send to the Paypal shipping address. The only way I can get the Paypal shipping address is from Paypal using their API....but the returned data is not XML (that I'm getting familiar with parsing) but it's in a format that looks like this...
I'm only interested in pulling out the shipping address in Red.
How would I tackle this?
I'm figuring dump the returned API data to a text file, then read down the text file line by line until I match "shipping_address", then pull in each line's data & pipe to an access table field?
Paypal API references:
https://developer.paypal.com/docs/api/payments/#sale_get)
https://developer.paypal.com/docs/api/overview/
Code:
{
"payments": [
{
"id": "PAY-0US81985GW1191216KOY7OXA",
"create_time": "2014-06-30T23:48:44Z",
"update_time": "2014-06-30T23:49:27Z",
"state": "approved",
"intent": "order",
"payer": {
"payment_method": "paypal"
},
"transactions": [
{
"amount": {
"total": "41.15",
"currency": "USD",
"details": {
"subtotal": "30.00",
"tax": "1.15",
"shipping": "10.00"
}
},
"description": "This is the payment transaction description.",
"item_list": {
"items": [
{
"name": "hat",
"sku": "1",
"price": "3.00",
"currency": "USD",
"quantity": "5"
},
{
"name": "handbag",
"sku": "product34",
"price": "15.00",
"currency": "USD",
"quantity": "1"
}
],
"shipping_address": {
[COLOR="Red"] "recipient_name": "John Doe",
"line1": "4th Floor,One Lagoon Drive",
"line2": "unit #34",
"city": "Redwood City",
"state": "CA",
"phone": "4084217591",
"postal_code": "94065",
"country_code": "US"[/COLOR]
And so on...
I'm only interested in pulling out the shipping address in Red.
How would I tackle this?
I'm figuring dump the returned API data to a text file, then read down the text file line by line until I match "shipping_address", then pull in each line's data & pipe to an access table field?
Paypal API references:
https://developer.paypal.com/docs/api/payments/#sale_get)
https://developer.paypal.com/docs/api/overview/