Sample Code: Submit Payment With Tokenization

Generating a Token

To generate a token, submit a payment transactions as described here: Sample Code: Submit Payment

Modify the above code to include the following in the formulatePaymentRequest() method:


payment.fw1__Create_Token__c = true;
payment.fw1__Account__c = <ACCOUNT ID>; // optional if contact exists
payment.fw1__Contact__c = <CONTACT ID>; // optional if account exists

After submitting the transaction, a payment record will be created and will have the generated token in the Token field (fw1__Payment__c.fw1__Token__c):

You can then save that token in a custom field in the Account or Contact object.

Using the Token

To use the token generated above, submit a payment transaction as described here: Sample Code: Submit Payment

Modify the code to remove the credit card information and replace them with the token. In the formulatePaymentRequest() method, remove the following:


payment.fw1__Credit_Card_Type__c = 'Visa';
payment.fw1__First_Name__c = 'Joe';
payment.fw1__Last_Name__c = 'Smith';
payment.fw1__Credit_Card_Number__c = '4111111111111111';
payment.fw1__Expiry_Month__c = '01';
payment.fw1__Expiry_Year__c = '2018';
payment.fw1__Billing_Street__c = '12345 sepulveda st';
payment.fw1__Billing_City__c = 'Torrance';
payment.fw1__Billing_State__c = 'CA';
payment.fw1__Billing_Zip__c = '90505';
payment.fw1__Billing_Country__c = 'US';
payment.fw1__Create_Token__c = true;

In the same formulatePaymentRequest() method, add the following:


payment.fw1__Token__c = <YOUR TOKEN>;

 

Was this article helpful?

Related Articles

Comments are closed.

  • About Us

    Kulturra.com builds enterprise apps on the Force.com platform. We have created some of the most popular apps on the AppExchange, and are being used by over 2000+ Salesforce users and continues to grow.

  • Our Culture

    As a company, we believe in simple. So we build simple applications out of complex processes. We also provide unparalleled customer support because we truly believe that our customers' success is our success. Read more on what our customers say about us.
  • Check Our Customer Reviews

    2015sf_Partner_Available_On_appexchange_RGB_Gray_Border
Copyright © 2020 Kulturra.com, Inc.
21151 S. Western Ave., Suite 215, Torrance, CA 90501, USA
MSA
All trademarks, trade names and logos appearing on the site are the property of their respective owners.
^ Back to Top