RPG Payments
The payment endpoint ('/api/payment') can be used to charge cards as well as working with transactions such as cancelling and capturing authorizations, refunding transactions and getting information on transactions.
Charging cards
To charge a card you need to perform a POST to the payment endpoint ('/api/payment'), you can use this to charge a card directly (Sale) or create an authorization on a card for future use (PreAuthorization).
3DSecure payments
The 3DSecure procedure is a procedure where the cardholder is authenticated resulting in less chance of fraudulent transactions. 3DSecure is mandatory for ecommerce transactions in Europe.
To enable 3DSecure payments you will need to connect to a Merchant Plugin Interface (MPI), SaltPay provides a MPI to its ECommerce customers but there are also other MPI vendors available. If you decide to use the MPI provided by SaltPay then RPG has a helper interface which can simplify the process. See 3DSecure - RPG Payments.
Request objects
PaymentRequest
Name | Description |
---|---|
TransactionType Required |
Type of transaction. Allowed values: 'PreAuthorization', 'Sale'. |
Amount Required |
Transaction amount, including two decimal points, i.e. 100 USD is 10000. An exception is JPY, it contains no decimal points. |
Currency Required |
Transaction currency in ISO4217 format. Example: 352 for ISK, 978 for EUR. |
TransactionDate Required |
Transaction date in ISO 8601 format YYYY-MM-ddTHH:mm:ddZ |
OrderId Required |
Reference number for the transaction. Must be exactly 12 characters. Only A-Z and 0-9 allowed. |
PaymentMethod Required |
Payment information object. |
ThreeDSecure Optional | Data required for 3DSecure transactions. ThreeDSecure object |
DynamicDescriptors Optional | DynamicDescriptors object, if allowed for merchant. |
Metadata Optional |
Metadata object for transaction that is specified by the merchant. Note: Never store sensitive data in the Metadata parameter |
PaymentMethod
Name | Description |
---|---|
PaymentType Required |
Type of payment method. Allowed values: 'Card', 'TokenSingle', 'TokenMulti'. |
Token Conditional |
Single or multi use card token. Required if PaymentType is TokenSingle or TokenMulti. |
PAN Conditional |
Credit card number. Required if PaymentType is Card. |
ExpYear Conditional |
Expiration year on card, format: YYYY. Required if PaymentType is Card. |
ExpMonth Conditional |
Expiration month on card, format: MM. Required if PaymentType is Card. |
CVC Conditional |
CVC value of card, mandatory for ECommerce transactions. |
Metadata
Name | Description |
---|---|
Payload Required |
Merchant Metadata associated with the transaction. Datatype is string. |
ThreeDSecure (3DSecure)
Name | Description |
---|---|
DataType Required |
Type of 3DSecure data in message. Allowed values: 'Token', 'Manual'. Note: The DataType value 'Manual' should only be used if an external MPI is being used. |
MpiToken Conditional |
MPI Token created by RPG. Required if DataType is Token. |
SecurityLevelInd Conditional |
Security Level Indicator – Used with Secure Code to indicate the security level used in electronic transactions. Required if DataType is Manual. |
UCAF Conditional |
Universal Cardholder Authentication Field – Used with Secure Code. Used if DataType is Manual. |
CAVV Conditional |
Base64 encoded cardholder authentication verification value. Used if DataType is Manual. |
Xid Conditional |
The unique transaction action id identifier encoded using Base64. Used if DataType is Manual. |
DSTransId Conditional |
A unique transaction id received by a Directory Server. Used if DataType is Manual and value is provided by the MPI. |
DynamicDescriptors
Note: Dynamic descriptors are enabled on per merchant basis, contact your service representative for more information.
Name | Description |
---|---|
MerchantName Required |
Merchant name. |
MerchantAddress | Merchant address. |
MerchantCity | Merchant city. |
MerchantZipCode | Merchant Zip Code. |
MerchantCountry | Merchant Country. |
Response objects
TransactionInfo
Name | Description |
---|---|
TransactionId Required |
Identifier of transaction in SaltPay's RPG system. |
TransactionType Required |
Transaction Type. Values: 'PreAuthorization', 'Sale', 'Refund'. |
Amount Required |
Transaction amount, including two decimal points, i.e. 100 USD is 10000. An exception is JPY, it contains no decimal points. |
Currency Required |
Transaction currency in ISO4217 format. Example: 352 for ISK, 978 for EUR. |
TransactionDate Required |
Transaction date in ISO 8601 format YYYY-MM-ddTHH:mm:ddZ |
OrderId Required |
Reference number for the transaction. Must be exactly 12 characters. A-Z and 0-9. |
AuthCode Conditional |
Authorization code of transaction. Required if transaction is successful. |
ActionCode Required |
ActionCode of the transaction. If ActionCode is "000" then transaction was successful. See list of ActionCode responses. |
TransactionStatus Required |
Status of transaction. Values: 'Accepted', 'Uncaptured', 'Captured', 'Declined', 'Cancelled', 'Refunded', 'RefundedPartial', 'Error'. |
Message | Message explanation if request was unsuccessful, if available. |
PaymentMethod Required |
Payment information object. |
Metadata Optional |
Metadata object for transaction that is specified by the merchant. |
PaymentMethod
Name | Description |
---|---|
PaymentType Required |
Type of payment method. Allowed values: 'Card', 'TokenSingle', 'TokenMulti'. |
Token Optional |
Single or multi use card token. Required if PaymentType is TokenSingle or TokenMulti. |
PAN Conditional |
Credit card number. Required if PaymentType is Card. |
ExpYear Conditional |
Expiration year on card, format: YYYY. Required if PaymentType is Card. |
ExpMonth Conditional |
Expiration month on card, format: MM. Required if PaymentType is Card. |
CVC Optional |
CVC value of card, can be provided if PaymentType is Card. |
CardType Optional |
Returns card brand if available. Example: MasterCard, VISA, AMEX... |
IsDebit Optional |
Returns whether the card is a debit card or not, if available. |
Metadata
Name | Description |
---|---|
Payload Required |
Merchant Metadata associated with the transaction. Datatype is string. |
Create Payment Examples
Example - Charging with card
curl <SERVICE_URL>/api/payment \
-u <PRIVATE_ACCESS_TOKEN>: \
-d "TransactionType=PreAuthorization" \
-d "Amount=100" \
-d "Currency=352" \
-d "TransactionDate=2015-10-10T11:00:00" \
-d "OrderId=TEST00000001" \
-d "PaymentMethod.PaymentType=Card" \
-d "PaymentMethod.PAN=4242424242424242" \
-d "PaymentMethod.ExpYear=2020" \
-d "PaymentMethod.ExpMonth=01"
PaymentRequest req = new PaymentRequest()
{
TransactionType = TransactionTypes.PreAuthorization,
PaymentMethod = new PaymentRequestMethod()
{
PaymentType = PaymentTypes.Card,
PAN = "4242424242424242",
ExpMonth = "10",
ExpYear = "2020"
},
Amount = 100,
Currency = "352",
OrderId = "IntegrTest01",
TransactionDate = DateTime.Now
};
RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentTransactionResponse response = await client.Payment.CreateAsync(req);
Example - Charging with Token
curl <SERVICE_URL>/api/payment \
-u <PRIVATE_ACCESS_TOKEN>: \
-d "TransactionType=PreAuthorization" \
-d "Amount=100" \
-d "Currency=352" \
-d "TransactionDate=2015-10-10T11:00:00" \
-d "OrderId=TEST00000001" \
-d "PaymentMethod.PaymentType=TokenSingle" \
-d "PaymentMethod.Token=<SINGLE_USE_TOKEN>"
PaymentRequest req = new PaymentRequest()
{
TransactionType = TransactionTypes.PreAuthorization,
PaymentMethod = new PaymentRequestMethod()
{
PaymentType = PaymentTypes.TokenSingle,
Token = "<SINGLE_USE_TOKEN>",
},
Amount = 100,
Currency = "352",
OrderId = "IntegrTest01",
TransactionDate = DateTime.Now
};
RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentTransactionResponse response = await client.Payment.CreateAsync(req);
Capture PreAuthorization
To finalize a sale that was previously pre authorized you can perform a PUT request to /api/payment/<TRANSACTION_ID>/capture where <TRANSACTION_ID> is the id of the PreAuthorization transaction.
Example - Capture PreAuthorization
curl <SERVICE_URL>/api/payment/<TRANSACTION_ID>/capture \
-u <PRIVATE_ACCESS_TOKEN>: \
-X PUT \
-d ""
RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentCaptureResponse response = await client.Payment.CaptureAsync("<TRANSACTION_ID>");
Cancel PreAuthorization
To cancel an existing PreAuthorization you can perform a PUT request to /api/payment/<TRANSACTION_ID>/cancel where <TRANSACTION_ID> is the id of the PreAuthorization transaction.
Example - Cancelling PreAuthorization
curl <SERVICE_URL>/api/token/single/<TOKEN> \
-u <PRIVATE_ACCESS_TOKEN>: \
-X DELETE
RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentCancelResponse response = await client.Payment.CancelAsync("<TRANSACTION_ID>");
Refund Transaction
To refund an existing transaction you can perform a PUT request to /api/payment/<TRANSACTION_ID>/refund where <TRANSACTION_ID> is the id of the transaction. NOTE: If Amount is not specified this will always try to refund the full amount of the original transaction. (See Partially refunding transaction)
Example - Refunding Transaction
curl <SERVICE_URL>/api/payment/<TRANSACTION_ID>/refund \
-u <PRIVATE_ACCESS_TOKEN>: \
-X PUT \
-d ""
RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentRefundResponse response = await client.Payment.RefundAsync("<TRANSACTION_ID>");
Partially refunding transaction
Refunds with amounts lower than the original transaction amount can be performed. Multiple refunds can be done as long as the total amount of the refunds do not exceed the amount of the original transactions.
Example - Partially refunding transaction
curl <SERVICE_URL>/api/payment/<TRANSACTION_ID>/refund \
-u <PRIVATE_ACCESS_TOKEN>: \
-X PUT \
-d "PartialAmount=100"
Get transaction info
Getting transaction information can be done by performing a GET request to /api/payment/<TRANSACTION_ID> where <TRANSACTION_ID> is the id of the transaction. This request will return a TransactionInfo object.
Example - Get Transaction
curl <SERVICE_URL>/api/payment/<TRANSACTION_ID> \
-u <PRIVATE_ACCESS_TOKEN>:
RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentTransactionResponse response = await client.Payment.GetTransactionAsync("<TRANSACTION_ID>");