Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hi all!
k, I have an issue with the final step of the payment, using Spreedly integration. I followed the article from here https://shopify.dev/tutorials/complete-a-sales-channel-payment-with-checkout-api#send-credit-card-in...
And all of the steps are successful, but in step 4 I dont get session ID, at least not explicitly, I tried to use token, but it says that the session_id is invalid. After reading the documentation I see that there is no session_id at all and Im not able to complete the payment.
Im including response.headers with X-Request-ID. I hope you can help me, because Im not sure where is the issue.
Here are logs from each step:
1. Create TEST Spreedly receiver
RESPONSE:
{'receiver': {'company_name': 'TEST', 'receiver_type': 'test', 'token': 'RKdpFrcEml84x2ehmKPSP8UpWWI', 'hostnames': 'https://elb.depos
it.shopifycs.com/', 'state': 'retained', 'created_at': '2020-06-16T11:39:37Z', 'updated_at': '2020-06-16T11:39:37Z', 'credentials': No
ne}}
2. Send details to shopify PCI storage
I assume that session_id is response[“transaction”][“token”], but it didnt work. I know that ID should be present in response object, but its not
RESPONSE:
{'transaction': {'token': 'AuTyoHsbOdcN1XeNpGxZY7gazDK', 'transaction_type': 'DeliverPaymentMethod', 'state': 'succeeded', 'created_at
': '2020-06-16T11:39:38Z', 'updated_at': '2020-06-16T11:39:38Z', 'succeeded': True, 'message': 'Succeeded!', 'url': 'https://elb.depos
it.shopifycs.com/sessions', 'response': {'status': 200, 'headers': 'Server: Spreedly Echo Server\r\nConnection: close\r\nContent-Lengt
h: 159', 'body': '{ "payment": { "credit_card":{ "number": "[FILTERED]", "month": "3", "year": "2032","verification_value": "423","fir
st_name":"Joe","last_name":"Jones"}}}'}, 'receiver': {'company_name': 'TEST', 'receiver_type': 'test', 'token': 'RKdpFrcEml84x2ehmKPSP
8UpWWI', 'hostnames': 'https://elb.deposit.shopifycs.com/', 'state': 'retained', 'created_at': '2020-06-16T11:39:37Z', 'updated_at': '
2020-06-16T11:39:37Z', 'credentials': None}, 'payment_method': {'token': 'CVTeRM6zywaU66Z12hYnnfanAuE', 'created_at': '2020-06-16T11:3
9:29Z', 'updated_at': '2020-06-16T11:39:38Z', 'email': 'joey@example.com', 'data': None, 'storage_state': 'used', 'test': True, 'metad
ata': None, 'callback_url': None, 'last_four_digits': '4444', 'first_six_digits': '555555', 'card_type': 'master', 'first_name': 'Joe'
, 'last_name': 'Jones', 'month': 3, 'year': 2032, 'address1': None, 'address2': None, 'city': None, 'state': None, 'zip': None, 'count
ry': None, 'phone_number': None, 'company': None, 'full_name': 'Joe Jones', 'eligible_for_card_updater': True, 'shipping_address1': No
ne, 'shipping_address2': None, 'shipping_city': None, 'shipping_state': None, 'shipping_zip': None, 'shipping_country': None, 'shippin
g_phone_number': None, 'payment_method_type': 'credit_card', 'errors': [], 'fingerprint': 'b5fe350d5135ab64a8f3c1097fadefd9effb', 'ver
ification_value': '', 'number': 'XXXX-XXXX-XXXX-4444'}}}
RESPONSE HEADER:
{'Connection': 'keep-alive', 'Content-Type': 'application/json; charset=utf-8
', 'Server': 'openresty', 'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', '
ETag': 'W/"1c33b88b87529b380485817bf94ef227"', 'Cache-Control': 'max-age=0, private, must-revalidate', 'X-Request-Id': 'a327f0bf-8492-
48ba-b080-075c2def3a09.core_b44eb2bdf52ed838', 'Accept-Ranges': 'bytes', 'Date': 'Tue, 16 Jun 2020 11:39:38 GMT', 'Via': '1.1 varnish'
, 'X-Served-By': 'cache-fra19142-FRA', 'X-Cache': 'MISS', 'X-Cache-Hits': '0', 'X-Timer': 'S1592307578.435751,VS0,VE430', 'Strict-Tran
sport-Security': 'max-age=31557600', 'transfer-encoding': 'chunked'}
3. Succesfully creating checkout in Shopify:
https://smisklep.myshopify.com/admin/api/2020-04/checkouts.json
INFO 2020-06-16 11:39:41,128 connection 45 140630351705856 --> 201 Created 2480b
4. Trying to process payment:
BODY IN PROCESS PAYMENT
{'payment': {'request_details': {'ip_address': '172.19.0.1', 'accept_language': 'en', 'user_agent': 'PostmanRuntime/7.20.1'}, 'amount': '99.00', 'session_id': 'AuTyoHsbOdcN1XeNpGxZY7gazDK', 'unique_token': 'c3e474fe-4f13-4d44-ae9b-951a4d8bce5e'
}}
RESPONSE:
{'errors': {'session_id': [{'code': 'invalid', 'message': 'is invalid', 'options': {}}]}}
RESPONSE HEADERS:
{'Date': 'Tue, 16 Jun 2020 11:39:41 GMT', 'C
ontent-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': '__cfduid=d
6e5021a5eb2570b1d22b5f1fb18c2aed1592307581; expires=Thu, 16-Jul-20 11:39:41 GMT; path=/; domain=.myshopify.com; HttpOnly; SameSite=Lax
', 'X-Sorting-Hat-PodId': '160', 'X-Sorting-Hat-ShopId': '40129527969', 'Referrer-Policy': 'origin-when-cross-origin', 'X-Frame-Option
s': 'DENY', 'X-ShopId': '40129527969', 'X-ShardId': '160', 'X-Stats-UserId': '', 'X-Stats-ApiClientId': '3905589', 'X-Stats-ApiPermiss
ionId': '253829120161', 'X-Shopify-API-Version': '2020-04', 'Strict-Transport-Security': 'max-age=7889238', 'X-Request-Id': '3f9c24ac-
a741-4df5-8576-e2910805e585', 'X-Shopify-Stage': 'production', 'Content-Security-Policy': "default-src 'self' data: blob: 'unsafe-inli
ne' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' w
ss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn
.net https://cdn.shopify.cn https://checkout.shopifycs.com https://js-agent.newrelic.com https://bam.nr-data.net https://api.stripe.co
m https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com
https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.
com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=create&source%5Bapp%5D=
Shopify&source%5Bcontroller%5D=admin%2Fcheckouts%2Fpayments&source%5Bsection%5D=admin_api&source%5Buuid%5D=3f9c24ac-a741-4df5-8576-e29
10805e585", 'X-Content-Type-Options': 'nosniff', 'X-Download-Options': 'noopen', 'X-Permitted-Cross-Domain-Policies': 'none', 'X-XSS-P
rotection': '1; mode=block; report=/xss-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fchecko
uts%2Fpayments&source%5Bsection%5D=admin_api&source%5Buuid%5D=3f9c24ac-a741-4df5-8576-e2910805e585', 'X-Dc': 'gcp-us-east1,gcp-us-east
1', 'CF-Cache-Status': 'DYNAMIC', 'cf-request-id': '035e8698ff0000c26d8c10c200000001', 'Expect-CT': 'max-age=604800, report-uri="https
://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Server': 'cloudflare', 'CF-RAY': '5a44406e6c8fc26d-FRA', 'alt-svc': 'h3-27="
:443"; ma=86400'}
Waiting for your response!
Ewelina
In step 4 in the response from Spreedly, do you see transaction.response.body? Inside of the body, you will see an ID that starts with east- or west- etc. This is the ID that you should be using to get this transaction to go through.
To learn more visit the Shopify Help Center or the Community Blog.
Hey @vix
I was having a similar issue. I am testing Spreedly integration with developer keys. I make POST request to this: https://core.spreedly.com/v1/receivers/LRBQO6hvoLI8VF71S0XWHLqJt0c/deliver.json
with this data:
{
"delivery": {
"payment_method_token": "ShPQPpSMpbwUCYZacLJNr4txlQm",
"url": "https://elb.deposit.shopifycs.com/sessions",
"headers": "Content-type: application/json",
"body":"{ \"payment\": { \"credit_card\":{ \"number\": \"{{ credit_card_number }}\", \"month\": \"{{ credit_card_month }}\", \"year\": \"{{ credit_card_year }}\", \"verification_value\": \"{{ credit_card_verification_value }}\", \"first_name\":\"{{ credit_card_first_name }}\", \"last_name\":\"{{ credit_card_last_name }}\"}}}"
}
}
and the response I get is:
{
"transaction": {
"token": "Su2O8JdJeyZjN9TtkIQfCaLczAN",
"transaction_type": "DeliverPaymentMethod",
"state": "succeeded",
"created_at": "2021-01-20T01:19:35Z",
"updated_at": "2021-01-20T01:19:35Z",
"succeeded": true,
"message": "Succeeded!",
"url": "https://elb.deposit.shopifycs.com/sessions",
"response": {
"status": 200,
"headers": "Server: Spreedly Echo Server\r\nConnection: close\r\nContent-Length: 159",
"body": "{ \"payment\": { \"credit_card\":{ \"number\": \"[FILTERED]\", \"month\": \"3\", \"year\": \"2032\", \"verification_value\": \"\", \"first_name\":\"Joe\", \"last_name\":\"Jones\"}}}"
},
"receiver": {
"company_name": "TEST",
"receiver_type": "test",
"token": "LRBQO6hvoLI8VF71S0XWHLqJt0c",
"hostnames": null,
"state": "retained",
"created_at": "2021-01-14T03:26:41Z",
"updated_at": "2021-01-14T03:26:41Z",
"credentials": null
},
"payment_method": {
"token": "ShPQPpSMpbwUCYZacLJNr4txlQm",
"created_at": "2021-01-20T00:23:52Z",
"updated_at": "2021-01-20T01:19:35Z",
"email": "joey@example.com",
"data": null,
"storage_state": "retained",
"test": true,
"metadata": null,
"callback_url": null,
"last_four_digits": "4444",
"first_six_digits": "555555",
"card_type": "master",
"first_name": "Joe",
"last_name": "Jones",
"month": 3,
"year": 2032,
"address1": null,
"address2": null,
"city": null,
"state": null,
"zip": null,
"country": null,
"phone_number": null,
"company": null,
"full_name": "Joe Jones",
"eligible_for_card_updater": true,
"shipping_address1": null,
"shipping_address2": null,
"shipping_city": null,
"shipping_state": null,
"shipping_zip": null,
"shipping_country": null,
"shipping_phone_number": null,
"payment_method_type": "credit_card",
"errors": [],
"fingerprint": "b5fe350d5135ab64a8f3c1097fadefd9effb",
"verification_value": "",
"number": "XXXX-XXXX-XXXX-4444"
}
}
}
There is no sign of the ID that starts with east- / west-
Would love you help?
Thanks
Hey @allymenan @ewelinabuturla !
You were using "Test" receiver on the Spreedly side.
The "Test" receiver doesn't send any data to the outside, it returns ("echo") you request body of the deliver call.
https://docs.spreedly.com/guides/payment-method-distribution/single-card/#provision-a-test-receiver
So, you need to create not a test receiver.