Checkout.js + Server-Side -> country_code and phone issues using REST API /v1/payments/payment - rest

Without avail, I cannot get the country_code (CA) or phone to fill up after successfully calling create payment.
Country always show up as "United States" and Phone is "+1".
With or without shipping_address, shipping_preference: NO_SHIPPING. Using so-called examples (which might be outdated or not correctly documented), and the API documentation, which would be great to have examples included...
This is the create-payment query in json. I'm getting the same structure back with the following additions:
id:PAY-xxx
state:created
phone in payer_info (but no country_code as expected from the API)
created_time
...and...
PayPal's links in links.
Which indicate that the call was successful.
Either I should ditch "/v1/payments/payment" for something else I'm not aware of, or Paypal API is not up-to-date.
----- json create-payment query -----
{
"intent": "sale",
"payer": {
"payment_method": "paypal",
"payer_info": {
"email": "<snip>",
"first_name": "Bob",
"last_name": "Smith",
"billing_address": {
"line1": "1 notre dame",
"line2": "",
"city": "Montreal",
"country_code": "CA",
"postal_code": "H1H 1H1",
"phone": "011862212345678",
"state": "QC"
}
}
},
"application_context": {
"brand_name": "Server-side Test",
"locale": "fr_CA",
"landing_page": "Billing"
},
"transactions": [
{
"description": "The payment transaction description.",
"invoice_number": "5b5a38cb35bb7",
"custom": "merchant custom data",
"payment_options": {
"allowed_payment_method": "INSTANT_FUNDING_SOURCE"
},
"amount": {
"total": "5.75",
"currency": "CAD",
"details": {
"subtotal": "5",
"tax": "0.75"
}
},
"item_list": {
"items": [
{
"name": "item 1",
"description": "item 1 description",
"quantity": "1",
"price": "1",
"tax": "0.15",
"currency": "CAD"
},
{
"name": "item 2",
"description": "item 2 description",
"quantity": "2",
"price": "2",
"tax": "0.6",
"currency": "CAD"
}
],
"shipping_address": {
"recipient_name": "Bob Smith",
"line1": "1 notre dame",
"line2": "",
"city": "Montreal",
"country_code": "CA",
"postal_code": "H1H 1H1",
"phone": "011862212345678",
"state": "QC"
}
}
}
],
"redirect_urls": {
"return_url": "http:\/\/<snip>\/return.php",
"cancel_url": "http:\/\/<snip>\/cancel.php"
}
}

Related

PayPal prefil Credit Card detaills

So Im trying to prefil the PayPal Credit Card with infos. Therefore I added a payer to my JSON:
"amount": {
"currency_code": "EUR",
"value": "100",
"breakdown": {
"item_total": {"currency_code": "EUR", "value": "100"}
}
},
"items": [
{
"name": "First Product Name",
"description": "Optional descriptive text..",
"unit_amount": {"currency_code": "EUR", "value": "50"},
"quantity": "1"
},
{
"name": "Second Product Name",
"description": "Optional descriptive text..",
"unit_amount": {"currency_code": "EUR", "value": "50"},
"quantity": "1"
},
],
"payer": {
"name": {
"given_name": 'PayPal',
"surname": 'Customer',
},
"address": {
"address_line_1": '123 ABC Street',
"address_line_2": 'Apt 2',
"admin_area_2": 'San Jose',
"admin_area_1": 'CA',
"postal_code": '95121',
"country_code": 'US',
},
},
"invoice_id": "invoice_number_2388",
The Problem is that even though I added the payer the Infos arent prefiled in the credit card. What have I done wrong?
The payer object is deprecated. For PayPal, there is payment_source.paypal. For sofort, payment_source.sofort object
But the main issue seems to be that you're putting this information inside the purchase_units array. It doesn't belong there.
There is a complete guide for integrating sofort in particular here: https://developer.paypal.com/docs/checkout/apm/sofort/

Is Google Pay PayPal depreceated?

So my problem is, PayPal suggested a request type that is depreceated, and I don't know what API to use so my integration with Google Pay works with Paypal. This is the api PayPal suggested: Google Pay Integration . The API returns this:
`{
"name": "INTERNAL_SERVICE_ERROR",
"message": "An internal service error has occurred",
"information_link": "https://developer.paypal.com/docs/api/payments/#errors",
"debug_id": "41a6f4507a2df"
}`
body is this:
` {
"intent": "sale",
"payer": {
"payment_method": "paypal",
"funding_instruments": [
{
"credit_card_token": {
"credit_card_id": "CARD-1MD19612EW4364010KGFNJQI",
"external_customer_id": "joe_shopper408-334-8890"
}
}
],
"payer_info": {
"email": "sb-coy8y5423854#personal.example.com",
"payer_id": "AR6cGL6IXfI_BwzZGeBcpES7ilv1FZqJlYeMr3TZnp-07woQCczOi1oTjiiz4HQLqQgrMVPE6Ng2QafR"
}
},
"transactions": [
{
"amount": {
"total": "30.11",
"currency": "USD",
"details": {
"subtotal": "30.00",
"tax": "0.07",
"shipping": "0.03",
"handling_fee": "1.00",
"shipping_discount": "-1.00",
"insurance": "0.01"
}
},
"description": "The payment transaction description.",
"invoice_number": "48787589673",
"payment_options": {
"allowed_payment_method": "INSTANT_FUNDING_SOURCE"
},
"soft_descriptor": "ECHI5786786",
"item_list": {
"items": [
{
"name": "hat",
"description": "Brown hat.",
"quantity": "5",
"price": "3",
"tax": "0.01",
"sku": "1",
"currency": "USD"
},
{
"name": "handbag",
"description": "Black handbag.",
"quantity": "1",
"price": "15",
"tax": "0.02",
"sku": "product34",
"currency": "USD"
}
],
"shipping_address": {
"recipient_name": "Brian Robinson",
"line1": "4th Floor",
"line2": "Unit #34",
"city": "San Jose",
"country_code": "US",
"postal_code": "95131",
"phone": "011862212345678",
"state": "CA"
}
}
}
],
"note_to_payer": "Contact us for any questions on your order.",
"redirect_urls": {
"return_url": "https://yourwebsite.com/return",
"cancel_url": "https://yourwebsite.com/cancel"
}
} `
Any tips in what request I should use? I'm making the test with a credit card token because my country doesn't have google pay and paypal suport. But I need the PayPal API that accepts Google Pay direct token.
Edit:
I used this guide and it informs this API url: api-m.sandbox.paypal.com/v1/payments/payment
But it always returns the error described. The V2 request is totally different and don't have support (in the payments) for capture. Need a diferent paypal api request but I don't know what to use.

INTERNAL_SERVICE_ERROR on PayPal order pay

Question updated - more details added.
I get a 500 (INTERNAL_SERVICE_ERROR) error from PayPal when I try to pay for an order.
I get ok from create order, and get the orderID - order status CREATED.
The order is approved by buyer - successfully and order status become APPROVED.
Order created by https://api.sandbox.paypal.com/v1/checkout/orders
Approved using paypal https://www.paypalobjects.com/api/checkout.js
{
"id": "53T50821FM697283T",
"gross_total_amount": {
"value": "26.66",
"currency": "ILS"
},
"purchase_units": [
{
"reference_id": "20180318-64466",
"amount": {
"currency": "ILS",
"total": "26.66"
},
"payee": {
"email": "d0535318380-classeeks#gmail.com"
},
"items": [
{
"name": "Meeting",
"sku": "20180318-64466",
"description": "Meeting 1/26/2018 1:00 AM-1/26/2018 2:20 AM. aaaaa",
"price": "26.66",
"currency": "ILS",
"quantity": 1
}
],
"shipping_address": {
"recipient_name": "Andrey Dyachenko",
"line1": "ישראליס 5 דירה 4",
"city": "תל-אביב",
"country_code": "IL",
"postal_code": "61014",
"state": "",
"type": "HOME_OR_WORK"
},
"partner_fee_details": {
"receiver": {
"email": "d0535318380-reciver#gmail.com"
},
"amount": {
"value": "12.66",
"currency": "ILS"
}
}
}
],
"payer_info": {
"email": "d0535318380-buyer#gmail.com",
"first_name": "Andrey",
"last_name": "Dyachenko",
"payer_id": "BZDA9RCZXKYQY",
"country_code": "IL",
"shipping_address": {
"recipient_name": "Andrey Dyachenko",
"line1": "ישראליס 5 דירה 4",
"city": "תל-אביב",
"country_code": "IL",
"postal_code": "61014",
"state": "",
"type": "HOME_OR_WORK"
}
},
"metadata": {
"supplementary_data": [
{
"name": "risk_correlation_id",
"value": "53T50821FM697283T"
},
{
"name": "buyer_ipaddress",
"value": "109.65.134.129"
},
{
"name": "external_channel",
"value": "WEB"
}
]
},
"redirect_urls": {
"return_url": "https://classeeks.com/order/details/70368c93-90db-4a8e-bd82-6d611acc2d17",
"cancel_url": "https://classeeks.com/order/details/70368c93-90db-4a8e-bd82-6d611acc2d17"
},
"create_time": "2018-03-18T19:49:11Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/checkout/orders/53T50821FM697283T",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/checkout/orders/53T50821FM697283T/capture",
"rel": "capture",
"method": "POST"
}
],
"status": "APPROVED"
}
Next step pay with https://api.sandbox.paypal.com/v1/checkout/orders/53T50821FM697283T/pay
{ "disbursement_mode":"DELAYED" }
Response
{
"name": "INTERNAL_SERVICE_ERROR",
"message": "The server encountered an internal error that prevented it from fulfilling this request.",
"information_link": "https://developer.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR",
"debug_id": "be0c6976ab17a"
}
Based https://demo.paypal.com/us/demo/go?page=cart
If you have created the order successfully, then you can either capture the order directly or create the authorization which places the fund on hold and later you can capture the authorization. Check the doc for PayPal order APIs.

uber RUSH API sandbox deliveries is_fragile value incorrect, bug?

While experimenting with the uber deliveries API sandbox I noticed that when I POST to https://sandbox-api.uber.com/v1/deliveries to create delivery of a new item with item[]."is fragile": true, that the response from the sandbox incorrectly shows item[]."is fragile": false. At least I think this is incorrect, I didn't see it listed as a known limitation of the sandbox. Is this a bug?
More information:
OS: Ubuntu 16.04.1 LTS
Client: Postman 4.9.0
POST request to URL https://sandbox-api.uber.com/v1/deliveries
POST /v1/deliveries HTTP/1.1
Host: sandbox-api.uber.com
Authorization: [redacted]
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: [redacted]
{
"items": [
{
"title": "Fragile Item",
"quantity": 1,
"price": 30,
"is_fragile": true,
"currency_code": "USD",
}
],
"dropoff": {
"location": {
"address": "530 W 113th Street",
"address_2": "Floor 2",
"city": "New York",
"country": "US",
"postal_code": "10025",
"state": "NY"
},
"contact": {
"first_name": "Alice",
"last_name": "Dropoff",
"email": "tomb#cryptocracy.net",
"phone": {
"number": "+19177447934",
"sms_enabled": "true",
},
}
},
"pickup": {
"location": {
"address": "636 W 28th Street",
"address_2": "Floor 2",
"city": "New York",
"country": "US",
"postal_code": "10001",
"state": "NY"
},
"contact": {
"first_name": "Bob",
"last_name": "Pickup",
"email": "tomb#cryptocracy.net",
"phone": {
"number": "+19177447934",
"sms_enabled": "true",
},
},
},
}
Response from the sandbox:
{
"status": "processing",
"dropoff": {
"eta": 12,
"signature_required": false,
"contact": {
"first_name": "Alice",
"last_name": "Dropoff",
"send_sms_notifications": true,
"send_email_notifications": true,
"phone": {
"sms_enabled": true,
"number": "+19177447934"
},
"email": "tomb#cryptocracy.net"
},
"special_instructions": "",
"location": {
"city": "New York",
"country": "US",
"longitude": -73.963863,
"state": "NY",
"postal_code": "10025",
"address_2": "Floor 2",
"address": "530 W 113th Street",
"latitude": 40.805264
},
"signature_image": {
"url": "",
"expires_at": "-62135596800"
},
"courier_notes": {}
},
"fee": 5,
"quote_id": "c7e135da-957e-40b7-a2c5-5d468dc1d686",
"courier": null,
"items": [
{
"weight": 0,
"title": "Bottle 3",
"price": 30,
"is_fragile": false,
"height": 0,
"width": 0,
"length": 0,
"currency_code": "USD",
"quantity": 1
}
],
"created_at": 1480961485,
"delivery_id": "21b1b8de-2cea-4bc4-a316-2fd7598787c7",
"pickup": {
"eta": 7,
"signature_required": false,
"contact": {
"first_name": "Bob",
"last_name": "Pickup",
"send_sms_notifications": true,
"send_email_notifications": true,
"phone": {
"sms_enabled": true,
"number": "+19177447934"
},
"email": "tomb#cryptocracy.net"
},
"special_instructions": "",
"location": {
"city": "New York",
"country": "US",
"longitude": -74.0064109,
"state": "NY",
"postal_code": "10001",
"address_2": "Floor 2",
"address": "636 W 28th Street",
"latitude": 40.7527293
},
"signature_image": {
"url": "",
"expires_at": "-62135596800"
},
"courier_notes": {}
},
"order_reference_id": "",
"tracking_url": "https://api.uber.com/v1/sandbox/map",
"currency_code": "USD"
}
This seems to be a bug in the Uber sandbox environment for the Deliveries API.

Tax lines won't automatically generate in Shopify API order

I am posting the following to the Shopify API order endpoint:
{
"order": {
"email": "some#email.com",
"financial_status": "paid",
"fulfillment_status": null,
"send_receipt": true,
"send_fulfillment_receipt": true,
"note": "Created by somename",
"line_items": [
{
"variant_id": 21718275463,
"quantity": 1,
"price": 99,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717700871,
"quantity": 1,
"price": 1000,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717690055,
"quantity": 1,
"price": 555,
"requires_shipping": true,
"product_id": 6821668807
}
],
"processing_method": "offsite",
"shipping_address": {
"first_name": "Chris",
"address1": "10101 Musick Road",
"phone": "9999999999",
"city": "St. Louis",
"zip": "63123",
"province": "MO",
"country": "United States",
"last_name": "Becker",
"name": "Chris Becker",
"country_code": "US",
"province_code": "MO"
},
"source_name": "somename",
"taxes_included": false,
"shipping_lines": [
{
"title": "standard",
"price": 0.00,
"code": null,
"source": "brand owner on shopify",
"carrier_identifier": null,
"tax_lines": null
}
],
"tags": "some Order"
}
}
and receiving a response without tax lines that are filled. I have seen on the shopify forum that the taxlines are supposed to then be automatically
calculated and filled by shopify. I tried doing it with a customer as well but that didn't work either.
The Orders API will not auto-calculate the taxes but if your app knows how much they are then you can include this data using tax_lines and total_tax:
{
"order": {
"line_items": [{
"title": "Big Brown Bear Boots",
"price": 74.99,
"quantity": 3,
"tax_lines": [{
"price": 13.50,
"rate": 0.06,
"title": "State tax"
}]
}],
"total_tax": 13.50
}
}