If you have your own app or custom functionality, you can call the Tokenize Profile global class to tokenize a payment profile that is created without a payment record.

fw1.PaymentProcessor.tokenizeProfile(fw1__PaymentProfile__c profile, String cvvCode);


List of arguments:

  • profile - Salesforce Id of the payment profile
  • cvvCode - CVV Code, optional

Here is a sample code snippet on how this can be used:

fw1__PaymentProfile__c profile = new fw1__PaymentProfile__c();            
profile.Name = 'SampleProfile-1';
profile.fw1__Account__c = '0012100000z5MDOAA2';
profile.fw1__Contact__c = '0032100000xKl0JAAS';
profile.fw1__Email__c = 'test@test.com';
profile.fw1__Type__c = 'Charge';
profile.fw1__UseAsDefault__c = true;
profile.fw1__CreditCardNumber__c = '4111111111111111';
profile.fw1__First_Name__c = 'Dev';
profile.fw1__Last_Name__c = 'One';
profile.fw1__ExpiryMonth__c = Datetime.now().format('MM');
profile.fw1__ExpiryYear__c = Datetime.now().addYears(2).format('yyyy');
profile.fw1__Billing_Street__c = '123 Main St';
profile.fw1__Billing_City__c = 'Torrance';
profile.fw1__Billing_State__c = 'CA';
profile.fw1__Billing_Zip__c = '90501';
profile.fw1__Billing_Country__c = 'US';
profile.fw1__Phone__c = '123456789';
profile.fw1__CreditCardType__c = 'Visa';
profile.fw1__Payment_Processor__c = 'a0E21000003w3nKEAQ';

fw1.PaymentProcessor.tokenizeProfile(profile,'123');
Database.insert(profile);