Issue with finalizing Payment with Spreedly

Highlighted
New Member
2 0 0

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

0 Likes
Highlighted
Shopify Staff
Shopify Staff
491 97 88

Hi @ewelinabuturla 

 

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. 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes