Documentation

SaltPay, all rights reserved. 2022 ©

PaymentAPI Functions Reference

PaymentAPI.CreateAsync

PaymentAPI.CreateAsync can be used to charge a customer. The function takes a PaymentRequest object as a parameter and returns a PaymentTransactionResponse object.


PaymentRequest req = new PaymentRequest()
{
    TransactionType = TransactionTypes.Sale,
    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);

  PaymentRequest req = new PaymentRequest()
  {
      TransactionType = TransactionTypes.Sale,
      PaymentMethod = new PaymentRequestMethod()
      {
          PaymentType = PaymentTypes.TokenMulti,
          Token = "<MY_CARD_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);
  

PaymentAPI.GetTransactionAsync

PaymentAPI.GetTransactionAsync takes a transaction identifier as a parameter and returns a PaymentTransactionResponse object.

RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentTransactionResponse response = await client.Payment.GetTransactionAsync("MY_TRANSACTION_ID");

PaymentAPI.CancelAsync

PaymentAPI.CancelAsync can be used to cancel a transaction of type PreAuthorization. It takes a transaction identifier as a parameter and returns a PaymentCancelResponse object.

RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentCancelResponse response = await client.Payment.CancelAsync("MY_TRANSACTION_ID");

PaymentAPI.CaptureAsync

PaymentAPI.CaptureAsync can be used to capture a transaction of type PreAuthorization, which will change the transaction type to Sale. It takes a transaction identifier as a parameter and returns a PaymentCaptureResponse object.

RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentCaptureResponse response = await client.Payment.CaptureAsync("MY_TRANSACTION_ID");

PaymentAPI.RefundAsync

PaymentAPI.RefundAsync can be used to refund a transaction of type Sale. It takes a transaction identifier as a parameter and returns a PaymentRefundResponse object.

RPGClient client = new RPGClient("<PRIVATE_ACCESS_TOKEN>", "<SERVICE_URL>");
PaymentRefundResponse response = await client.Payment.RefundAsync("MY_TRANSACTION_ID");

PaymentAPI Class Reference

PaymentRequest

Name Description
TransactionType
Required
Type of transaction. Allowed values: 'PreAuthorization', 'Sale'.
Amount
Required
Transaction amount, in general it includes two decimal points, i.e. 100 USD is 10000. Currently JPY is the only exception, it contains no decimal points.
Currency
Required
Transaction currency in ISO4217 format. Example: 352 for ISK, 978 for EUR.
TransactionDate
Required
Transaction date
OrderId
Required
Reference number for transaction. Must be exactly 12 characters. A-Z and 0-9.
PaymentMethod
Required
Payment method information object. See PaymentRequestMethod.
Metadata Metadata object for transaction that is specified by the merchant. See Metadata.

PaymentRequestMethod

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.

Metadata

Name Description
Payload
Required
Merchant Metadata associated with the transaction. Datatype is string.

PaymentTransactionResponse

Name Description
StatusCode
Required
Http Status Code returned from server.
Transaction
Conditional
If request was successful this will include a TransactionInfo object.
Uri ContentLocation header value if it was provided by the response.
Message Message provided by response in case of error or warning.

TransactionInfo

Name Description
TransactionId
Required
Identifier of transaction in SaltPay RPG system.
TransactionType
Required
Transaction Type. Values: 'PreAuthorization', 'Sale'.
Amount
Required
Transaction amount, in general it includes two decimal points, i.e. 100 USD is 10000. Currently JPY is the only exception, it contains no decimal points.
Currency
Required
Transaction currency in ISO4217 format. Example: 352 for ISK, 978 for EUR.
TransactionDate
Required
Transaction date.
OrderId
Required
Reference number for 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 transaction. If ActionCode is "000" then transaction was successful. See list of ActionCode responses.
TransactionStatus
Required
Status of transaction. Values: 'Accepted', 'Uncaptured', 'Capture', 'Decline', 'Cancelled', 'Refunded', 'Error'.
Message Message explanation if available.
PaymentMethod
Required
Payment method information object. See TransactionInfoMethod.
Metadata Metadata object for transaction that is specified by the merchant. See Metadata.

TransactionInfoMethod

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 Returns card brand if available. Example: MasterCard, VISA, AMEX...
IsDebit Returns whether the card is a debit card or not, if available.

PaymentCancelResponse

Name Description
StatusCode
Required
Http Status Code returned from server.
Result
Conditional
If request was successful this will include a CancelAuthorizationResponse object.
Message Message provided by response in case of error or warning.

CancelAuthorizationResponse

Name Description
TransactionId
Required
Identifier of transaction in SaltPay RPG system.
ActionCode
Required
ActionCode of cancel request. See list of action codes.
Message Message if form error occurs.

PaymentCaptureResponse

Name Description
StatusCode
Required
Http Status Code returned from server.
Result
Conditional
If request was successful this will include a CaptureAuthorizationResponse object.
Message Message provided by response in case of error or warning.

CaptureAuthorizationResponse

Name Description
TransactionId
Required
Identifier of transaction in SaltPay RPG system.
ActionCode
Required
ActionCode of cancel request. See list of action codes.
Message Message if form error occurs.

PaymentRefundResponse

Name Description
StatusCode
Required
Http Status Code returned from server.
Result
Conditional
If request was successful this will include a RefundAuthorizationResponse object.
Message Message provided by response in case of error or warning.

RefundAuthorizationResponse

Name Description
TransactionId
Required
Identifier of transaction in SaltPay RPG system.
ActionCode
Required
ActionCode of cancel request. See list of action codes.
Message Message if form error occurs.