Paymend Gateway Guide

Additional notes
Set sandbox to true when creating the gateway to route transactions to the Paymend sandbox environment (api.sandbox.paymend.com). Omit it, or set false, for production.
The api_token is stored securely and is never returned in API responses. Only store_id is echoed back in the credentials list.

Adding a Paymend gateway

curl https://core.spreedly.com/v1/gateways.xml \
  -u '{environment_key}:{access_secret}' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>
  <gateway_type>paymend</gateway_type>
  <store_id>{store_id}</store_id>
  <api_token>{api_token}</api_token>
  <sandbox>true</sandbox>
</gateway>'
<gateway>
  <token>{gateway_token}</token>
  <gateway_type>paymend</gateway_type>
  <name>Paymend</name>
  <description nil="true"/>
  <store_id>{store_id}</store_id>
  <characteristics>
    <supports_purchase type="boolean">true</supports_purchase>
    <supports_authorize type="boolean">true</supports_authorize>
    <supports_capture type="boolean">true</supports_capture>
    <supports_partial_capture type="boolean">true</supports_partial_capture>
    <supports_credit type="boolean">true</supports_credit>
    <supports_refund type="boolean">true</supports_refund>
    <supports_partial_credit type="boolean">false</supports_partial_credit>
    <supports_general_credit type="boolean">false</supports_general_credit>
    <supports_void type="boolean">true</supports_void>
    <supports_verify type="boolean">false</supports_verify>
    <supports_reference_purchase type="boolean">false</supports_reference_purchase>
    <supports_purchase_via_preauthorization type="boolean">false</supports_purchase_via_preauthorization>
    <supports_offsite_purchase type="boolean">false</supports_offsite_purchase>
    <supports_offsite_authorize type="boolean">false</supports_offsite_authorize>
    <supports_3dsecure_purchase type="boolean">false</supports_3dsecure_purchase>
    <supports_3dsecure_authorize type="boolean">false</supports_3dsecure_authorize>
    <supports_store type="boolean">false</supports_store>
    <supports_remove type="boolean">false</supports_remove>
    <supports_fraud_review type="boolean">false</supports_fraud_review>
    <supports_network_tokenization type="boolean">false</supports_network_tokenization>
    <supports_stored_credentials type="boolean">false</supports_stored_credentials>
  </characteristics>
  <credentials>
    <credential>
      <name>store_id</name>
      <value>{store_id}</value>
    </credential>
  </credentials>
  <payment_methods>
    <payment_method>credit_card</payment_method>
  </payment_methods>
  <state>retained</state>
  <redacted type="boolean">false</redacted>
  <sandbox type="boolean">true</sandbox>
  <mode>default</mode>
</gateway>

Parameters

NameDescription
store_id (Required)Your Paymend Store ID
api_token (Required)Your Paymend API Token

Example transactions

The examples below are taken from a Paymend sandbox validation run. Tokens and identifiers are shown as placeholders.

Purchase

A purchase authorizes and captures the amount in a single step.

curl https://core.spreedly.com/v1/gateways/{gateway_token}/purchase.xml \
  -u '{environment_key}:{access_secret}' \
  -H 'Content-Type: application/xml' \
  -d '<transaction>
  <payment_method_token>{payment_method_token}</payment_method_token>
  <amount>1000</amount>
  <currency_code>USD</currency_code>
  <order_id>{order_id}</order_id>
  <description>Paymend purchase</description>
</transaction>'
<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>{transaction_token}</token>
  <transaction_type>Purchase</transaction_type>
  <order_id>{order_id}</order_id>
  <gateway_transaction_id>{gateway_transaction_id}</gateway_transaction_id>
  <amount type="integer">1000</amount>
  <currency_code>USD</currency_code>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>{gateway_token}</gateway_token>
  <gateway_type>paymend</gateway_type>
  <response>
    <success type="boolean">true</success>
    <message>CAPTURED</message>
    <error_code></error_code>
    <cancelled type="boolean">false</cancelled>
  </response>
</transaction>

Authorize

An authorization reserves the amount without capturing it.

curl https://core.spreedly.com/v1/gateways/{gateway_token}/authorize.xml \
  -u '{environment_key}:{access_secret}' \
  -H 'Content-Type: application/xml' \
  -d '<transaction>
  <payment_method_token>{payment_method_token}</payment_method_token>
  <amount>1000</amount>
  <currency_code>USD</currency_code>
  <order_id>{order_id}</order_id>
  <description>Paymend authorize</description>
</transaction>'
<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>{transaction_token}</token>
  <transaction_type>Authorization</transaction_type>
  <order_id>{order_id}</order_id>
  <gateway_transaction_id>{gateway_transaction_id}</gateway_transaction_id>
  <amount type="integer">1000</amount>
  <currency_code>USD</currency_code>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>{gateway_token}</gateway_token>
  <gateway_type>paymend</gateway_type>
  <response>
    <success type="boolean">true</success>
    <message>AUTHORIZED</message>
    <error_code></error_code>
    <cancelled type="boolean">false</cancelled>
  </response>
</transaction>

Capture

Capture a prior authorization. Paymend supports partial capture: pass an amount smaller than the authorized amount to capture part of it.

curl https://core.spreedly.com/v1/transactions/{transaction_token}/capture.xml \
  -u '{environment_key}:{access_secret}' \
  -H 'Content-Type: application/xml' \
  -d '<transaction></transaction>'
<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>{transaction_token}</token>
  <transaction_type>Capture</transaction_type>
  <gateway_transaction_id>{gateway_transaction_id}</gateway_transaction_id>
  <amount type="integer">1000</amount>
  <currency_code>USD</currency_code>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>{gateway_token}</gateway_token>
  <gateway_type>paymend</gateway_type>
  <response>
    <success type="boolean">true</success>
    <message>CAPTURED</message>
    <error_code></error_code>
    <cancelled type="boolean">false</cancelled>
  </response>
</transaction>

Void

Void an authorization that has not been captured.

curl https://core.spreedly.com/v1/transactions/{transaction_token}/void.xml \
  -u '{environment_key}:{access_secret}' \
  -H 'Content-Type: application/xml' \
  -d '<transaction></transaction>'
<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>{transaction_token}</token>
  <transaction_type>Void</transaction_type>
  <gateway_transaction_id>{gateway_transaction_id}</gateway_transaction_id>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>{gateway_token}</gateway_token>
  <gateway_type>paymend</gateway_type>
  <response>
    <success type="boolean">true</success>
    <message>VOIDED</message>
    <error_code></error_code>
    <cancelled type="boolean">false</cancelled>
  </response>
</transaction>

Refund

Refund a settled transaction with a credit.

curl https://core.spreedly.com/v1/transactions/{transaction_token}/credit.xml \
  -u '{environment_key}:{access_secret}' \
  -H 'Content-Type: application/xml' \
  -d '<transaction></transaction>'
<transaction>
  <on_test_gateway type="boolean">true</on_test_gateway>
  <succeeded type="boolean">true</succeeded>
  <state>succeeded</state>
  <token>{transaction_token}</token>
  <transaction_type>Credit</transaction_type>
  <gateway_transaction_id>{gateway_transaction_id}</gateway_transaction_id>
  <amount type="integer">1000</amount>
  <currency_code>USD</currency_code>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>{gateway_token}</gateway_token>
  <gateway_type>paymend</gateway_type>
  <response>
    <success type="boolean">true</success>
    <message>REFUNDED</message>
    <error_code></error_code>
    <cancelled type="boolean">false</cancelled>
  </response>
</transaction>

Did this page help you?