Logo

How can we help you?

Search our knowledge base to get answers to your questions, access video training & more!

Submit Payment API

Developer

Submit Payment API

Last updated on 11 Dec, 2025

Submit Payment API

As its name suggest, this API submits payment to your processor. You can either submit an authorization or a charge. It also creates the corresponding payment record in Salesforce.

You submit payment in the following form:

curl -v https://<instance>.salesforce.com/services/apexrest/fw1/v2/payments \ 
     -H 'Authorization: Bearer <access token>' \ 
     -H 'Content-Type: application/json' \
     -X POST \
     -d '{<arguments>}'

To get an access token, read here: Authentication

 

EXAMPLE REQUEST:

curl -v https://na14.salesforce.com/services/apexrest/fw1/v2/payments \
     -H 'Authorization: Bearer 00Dx0000000exxV!AXXXXXfcKqHB0czbxxxxxHkyo9gt41BxxxhWPxxZzaXxXxbAJxx9Ov4Hno..mu1Xi5XXXX8MWHVD81JVr6ShxxxxxorGv6Uy' \ 
     -H 'Content-Type: application/json' \ 
     -X POST \ 
     -d '{"amount":9.99, 
          "credit_card_number":"4111111111111111", 
          "expiry_month":"08", 
          "expiry_year":"2018", 
          "first_name":"Jeff", 
          "last_name":"Johnson", 
          "billing_street":"12345 Jefferson St.", 
          "billing_city":"Torrance", 
          "billing_state":"CA", 
          "billing_zip":"90501", 
          "billing_country":"US"}'

 

EXAMPLE RESPONSE:

{"type":"Charge",
  "status":"Captured",
  "salesforce_payment_id":"a0Ad000000MXxZxXXL",
  "processor_transaction_id":"2219157406",
  "processor":"Authorize.Net",
  "payment_date":"2014-09-09T04:20:23.563Z",
  "message":"This transaction has been approved.",
  "is_successful":true,
  "cvv2_match":null,
  "avs_code":null,
  "amount_currency":"USD",
  "amount":9.99}

is_successful (true/false) indicates whether or not the payment was successful.

If payment was not successful, the corresponding error message will be listed in message.

If payment was successful, salesforce_payment_id will contain the ID of the payment record created in Salesforce.

 

COMPLETE LIST OF ARGUMENTS

  • amount – required, a positive decimal number, i.e. 9.99

  • credit_card_number – required

  • expiry_month – required, 2-digit month, i.e. 01 for January

  • expiry_year – required, 4-digit year

  • first_name – required, first name as it appears on the card

  • last_name – required, last name as it appears on the card

  • cvv2 – required or optional depending on your setting, this is the security code

  • billing_street – required, billing street associated with the card

  • billing_city – required, billing city associated with the card

  • billing_state – required, billing state associated with the card. This is not required for non-US addresses

  • billing_zip – required, billing zip associated with the card

  • billing_country – required, billing country associated with the card

  • trans_type –  optional, values could be Charge or Authorization. If not sent, the default value from settings will be used

  • processor –  optional, name of your processor as defined in your settings. If not sent, the default will be used.

  • payment_name – optional, any name to identify your payment. If not sent, a name will be created for you.

  • reference – optional, any reference related to your payment, i.e. order number, invoice number, etc.

  • amount_currency – optional, 3-letter ISO code for currency, i.e USD, EUR, etc. If not sent, the default value from settings will be used

  • shipping_street – optional, customer shipping street

  • shipping_city – optional, customer shipping city

  • shipping_state – optional, customer shipping state

  • shipping_zip – optional, customer shipping zip

  • shipping_country – optional, customer shipping country

  • email – optional, customer email address. This is required if your processor is CyberSource

  • routing_number – required if paying by eCheck

  • account_number – required if paying by eCheck, this is the bank account number

  • name_on_account – optional, name on bank account

  • related_object_field – optional, if payment is to be related to a record, pass the lookup field name (API name) as defined in fw1__Payment__c object

  • related_record_id – optional, the ID of the record where the payment will be related

  • related_object_name – optional, if you want to update the related object with the paid amount, pass the object name (API name) here

  • related_object_paid_amount_field – optional, name (API name) of the field in the related object that holds the paid amount

  • account_id – you can pass an account ID to relate the payment to the account

  • contact_id – you can pass a contact ID to relate the payment to the contact

  • opportunity_id – you can pass an opportunity ID to relate the payment to the opportunity

  • invoice_id – you can pass an invoice ID to relate the payment to the invoice

  • processor_category – If you have categorized your processors, you can pass the category here and the system will select the appropriate processor based on the category. More info here: Using Multiple Processors

  • profile_id – you can pass a payment profile ID, and the details such as credit card number, etc. will be taken from the profile. Although you don’t need a credit card since it will be taken from the profile, you cannot pass a null value to it. So along with the “profile_id”, please pass the parameter “credit_card_number”, you can pass a space to it (but not null)

 

Did you find this article helpful?
Previous

Void Payment API

Next