Deliver
POST /v1/receivers/<receiver_token>/deliver.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>
{
"delivery": {
"payment_method_token": "56wyNnSmuA6CWYP7w0MiYCVIbW6",
"url": "https://spreedly-echo.herokuapp.com",
"headers": "Content-Type: application/json",
"body": "{ \"product_id\": \"916598\", \"card_number\": \"{{credit_card_number}}\" }"
}
}
<delivery>
<payment_method_token>56wyNnSmuA6CWYP7w0MiYCVIbW6</payment_method_token>
<url>https://spreedly-echo.herokuapp.com</url>
<headers>
<![CDATA[Content-Type: application/json]]>
</headers>
<body>
<![CDATA[{
"product_id":"916593",
"card_number":"{{ credit_card_number }}"
}]]>
</body>
</delivery>
HTTPS/1.1 200 OK
{
"transaction": {
"token": "NQkQlB8BpQspzTnEloIDsbG7juy",
"transaction_type": "DeliverPaymentMethod",
"state": "succeeded",
"created_at": "2017-07-27T17:55:26Z",
"updated_at": "2017-07-27T17:55:26Z",
"succeeded": true,
"message": "Succeeded!",
"url": "https://spreedly-echo.herokuapp.com",
"response": {
"status": 200,
"headers": "Date: Thu, 27 Jul 2017 17:55:26 GMT\r\nConnection: close\r\nHost: spreedly-echo.herokuapp.com\r\nAccept: */*\r\nUser_agent: spreedly-agent/Typhoeus 0.6.9\r\nX_request_id: 0df136cb-6298-4c37-9d5e-a995dce53637\r\nX_forwarded_for: 167.88.149.182\r\nX_forwarded_proto: https\r\nX_forwarded_port: 443\r\nVia: 1.1 vegur, 1.1 vegur\r\nConnect_time: 3\r\nX_request_start: 1501178126796\r\nTotal_route_time: 0\r\nX-Runtime: 0.000177\r\nServer: thin 1.6.2 codename Doc Brown",
"body": "HOST: spreedly-echo.herokuapp.com\r\nCONNECTION: close\r\nACCEPT: */*\r\nUSER_AGENT: spreedly-agent/Typhoeus 0.6.9\r\nX_REQUEST_ID: 0df136cb-6298-4c37-9d5e-a995dce53637\r\nX_FORWARDED_FOR: 167.88.149.182\r\nX_FORWARDED_PROTO: https\r\nX_FORWARDED_PORT: 443\r\nVIA: 1.1 vegur\r\nCONNECT_TIME: 3\r\nX_REQUEST_START: 1501178126796\r\nTOTAL_ROUTE_TIME: 0\r\n\r\n{ \"product_id\": \"916598\", \"card_number\": \"[FILTERED]\" }"
},
"receiver": {
"company_name": "TEST",
"receiver_type": "test",
"token": "5FvWNRyXVLnOAVfZKUOJRgmziG0",
"hostnames": "https://spreedly-echo.herokuapp.com",
"state": "retained",
"created_at": "2017-07-27T17:55:26Z",
"updated_at": "2017-07-27T17:55:26Z",
"credentials": [
{
"name": "app-id",
"value": "1234",
"safe": "true"
},
{
"name": "app-secret",
"safe": "false"
}
]
},
"payment_method": {
"token": "1rpKvP8zOUhj4Y9EDrIoIYQzzD5",
"created_at": "2017-06-26T17:04:38Z",
"updated_at": "2017-07-27T17:55:26Z",
"email": "joey@example.com",
"data": {
"my_payment_method_identifier": "448",
"extra_stuff": {
"some_other_things": "Can be anything really"
}
},
"storage_state": "retained",
"test": true,
"metadata": {
"key": "string value",
"another_key": 123,
"final_key": true
},
"last_four_digits": "1111",
"first_six_digits": "411111",
"card_type": "visa",
"first_name": "Newfirst",
"last_name": "Newlast",
"month": 3,
"year": 2032,
"address1": null,
"address2": null,
"city": null,
"state": null,
"zip": null,
"country": null,
"phone_number": null,
"company": null,
"full_name": "Newfirst Newlast",
"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",
"bin_metadata": {
"card_brand": "DISCOVER",
"card_category": "PERSONAL",
"card_type": "CREDIT",
"issuing_bank": "DISCOVER BANK",
"issuing_country_iso_number": "840",
"issuing_country_iso_a2_code": "US",
"issuing_country_iso_a3_code": "USA",
"issuing_country_iso_name": "UNITED STATES",
"issuing_bank_phone_number": "1 (800) 347-7000",
"issuing_bank_website": "HTTPS://WWW.DISCOVER.COM/",
"bin_type": "PERSONAL",
"regulated": "Y",
"max_pan_length": 19,
"message": "Successful"
},
"errors": [
],
"fingerprint": "e3cef43464fc832f6e04f187df25af497994",
"verification_value": "",
"number": "XXXX-XXXX-XXXX-1111"
}
}
}
<transaction>
<token>L04jnLlUabbHw6Zr21YUEhN8WKR</token>
<transaction_type>DeliverPaymentMethod</transaction_type>
<state>succeeded</state>
<created_at type="dateTime">2017-07-27T17:55:27Z</created_at>
<updated_at type="dateTime">2017-07-27T17:55:27Z</updated_at>
<succeeded type="boolean">true</succeeded>
<message>Succeeded!</message>
<url>https://spreedly-echo.herokuapp.com</url>
<response>
<status type="integer">200</status>
<headers>
<![CDATA[Date: Thu, 27 Jul 2017 17:55:27 GMT
Connection: close
Host: spreedly-echo.herokuapp.com
Accept: */*
User_agent: spreedly-agent/Typhoeus 0.6.9
X_request_id: b00f0e1e-e2ec-41f4-938b-53dd14598da7
X_forwarded_for: 167.88.149.182
X_forwarded_proto: https
X_forwarded_port: 443
Via: 1.1 vegur, 1.1 vegur
Connect_time: 1
X_request_start: 1501178127860
Total_route_time: 0
X-Runtime: 0.000148
Server: thin 1.6.2 codename Doc Brown]]>
</headers>
<body>
<![CDATA[HOST: spreedly-echo.herokuapp.com
CONNECTION: close
ACCEPT: */*
USER_AGENT: spreedly-agent/Typhoeus 0.6.9
X_REQUEST_ID: b00f0e1e-e2ec-41f4-938b-53dd14598da7
X_FORWARDED_FOR: 167.88.149.182
X_FORWARDED_PROTO: https
X_FORWARDED_PORT: 443
VIA: 1.1 vegur
CONNECT_TIME: 1
X_REQUEST_START: 1501178127860
TOTAL_ROUTE_TIME: 0
{
"product_id":"916593",
"card_number":"[FILTERED]"
}]]>
</body>
</response>
<receiver>
<company_name>TEST</company_name>
<receiver_type>test</receiver_type>
<token>MkMQdYr2dd6OaeKj8eXC1vWTSf1</token>
<hostnames>https://spreedly-echo.herokuapp.com</hostnames>
<state>retained</state>
<created_at type="dateTime">2017-07-27T17:55:27Z</created_at>
<updated_at type="dateTime">2017-07-27T17:55:27Z</updated_at>
<credentials type="array">
<credential>
<name>app-id</name>
<value>1234</value>
<safe>true</safe>
</credential>
<credential>
<name>app-secret</name>
<safe>false</safe>
</credential>
</credentials>
</receiver>
<payment_method>
<token>1rpKvP8zOUhj4Y9EDrIoIYQzzD5</token>
<created_at type="dateTime">2017-06-26T17:04:38Z</created_at>
<updated_at type="dateTime">2017-07-27T17:55:27Z</updated_at>
<email>joey@example.com</email>
<data>
<my_payment_method_identifier>448</my_payment_method_identifier>
<extra_stuff>
<some_other_things>Can be anything really</some_other_things>
</extra_stuff>
</data>
<storage_state>retained</storage_state>
<test type="boolean">true</test>
<metadata>
<key>String Value</key>
<another_key>123</another_key>
<final_key>true</final_key>
</metadata>
<last_four_digits>1111</last_four_digits>
<first_six_digits>411111</first_six_digits>
<card_type>visa</card_type>
<first_name>Newfirst</first_name>
<last_name>Newlast</last_name>
<month type="integer">3</month>
<year type="integer">2032</year>
<address1 nil="true"></address1>
<address2 nil="true"></address2>
<city nil="true"></city>
<state nil="true"></state>
<zip nil="true"></zip>
<country nil="true"></country>
<phone_number nil="true"></phone_number>
<company nil="true"></company>
<full_name>Newfirst Newlast</full_name>
<eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
<shipping_address1 nil="true"></shipping_address1>
<shipping_address2 nil="true"></shipping_address2>
<shipping_city nil="true"></shipping_city>
<shipping_state nil="true"></shipping_state>
<shipping_zip nil="true"></shipping_zip>
<shipping_country nil="true"></shipping_country>
<shipping_phone_number nil="true"></shipping_phone_number>
<payment_method_type>credit_card</payment_method_type>
<bin_metadata>
<card_brand>DISCOVER</card_brand>
<card_category>PERSONAL</card_category>
<card_type>CREDIT</card_type>
<issuing_bank>DISCOVER BANK</issuing_bank>
<issuing_country_iso_number>840</issuing_country_iso_number>
<issuing_country_iso_a2_code>US</issuing_country_iso_a2_code>
<issuing_country_iso_a3_code>USA</issuing_country_iso_a3_code>
<issuing_country_iso_name>UNITED STATES</issuing_country_iso_name>
<issuing_bank_phone_number>1 (800) 347-7000</issuing_bank_phone_number>
<issuing_bank_website>HTTPS://WWW.DISCOVER.COM/</issuing_bank_website>
<bin_type>PERSONAL</bin_type>
<regulated>Y</regulated>
<max_pan_length>19</max_pan_length>
<message>Successful</message>
</bin_metadata>
<errors>
</errors>
<verification_value></verification_value>
<number>XXXX-XXXX-XXXX-1111</number>
<fingerprint>e3cef43464fc832f6e04f187df25af497994</fingerprint>
</payment_method>
</transaction>
Deliver a payment method to the specified receiver endpoint. See the guide on payment method distribution to understand how to specify what is sent to the receiver. Spreedly provides an open repository of code templates for simplifying implementation of new receivers.
URL Parameters
Parameter | Description |
---|---|
receiver_token required |
The token of the receiver at Spreedly |
format required |
One of json or xml |
Request Body
Parameter | Description |
---|---|
delivery | Root element |
❯ continue_caching | An option to keep the cvv cached for a few minutes. Otherwise cvv is deleted immediately. |
❯ payment_method_token required |
The token of the payment method to send to the receiver and whose values will be applied to the delivery template |
❯ url required |
The fully qualified URL to send the payment method. The URL must have the same hostname as one of the allowed hostnames for the target receiver. The URL string can include distribution variable placeholders, e.g., https://prod.receiver.com/path/book?user={{ user_name }} . |
❯ request_method | An option to specify the HTTP method to use when contacting the receiver. Acceptable values are PUT , PATCH , and POST . If omitted, the default value is POST . |
❯ headers | The request headers to be sent to the receiver as a colon-delimited, new-line separated, string. Host and Content-Length can be omitted as they are automatically generated by Spreedly. Headers can include distribution variable placeholders, e.g., User: {{ user_name }} . |
❯ body required |
The request body that will get sent to the receiver. The body can include distribution variable placeholders, e.g., <cardNumber>{{ credit_card_number }}</cardNumber> . |
❯ encode_response default: false |
If true , the response_body value in the delivery transaction response will be base64 encoded. This is useful if there are characters in the response known to cause encoding or other formatting issues. |
❯ sub_merchant_key | The token of the sub-merchant to associate with the current transaction. If an invalid sub_merchant_key is passed through, the value defaults to null |
Response Body
Notable response elements include:
Element | Description |
---|---|
transaction | Root element |
❯ token | The token of this transaction |
❯ succeeded | If the delivery request completed with a non-error HTTP status (2XX) |
❯ message | A brief description of the result of the transaction |
❯ response | The raw response status, header and body returned from the receiver. Parse these values to retrieve relevant response fields. |
❯❯ status | The status code returned by the receiver. |
❯❯ headers | The headers, as delivered exactly by the receiver. |
❯❯ body | The raw body delivered from the receiver, with account numbers and sensitive data redacted. |
❯ receiver | The receiver the payment method was delivered to |
❯ payment_method | The payment_method sent to the receiver |
❯ sub_merchant_key | The token of the sub-merchant associated with the transaction. |
A successful (HTTP 200) response from the Spreedly API indicates that Spreedly was able to successfully communicate with the receiver (response code < 400 ), it does not indicate that the final status at the endpoint. You must check the status
field of the response
element to see the actual status code from the receiver endpoint.
BIN metadata is available in the response if the card is enrolled in Advanced Vault. See BIN metadata for more information.