Website Integration: One-Off Payment (Payment Intent)
This is a general scenario of one-off payment when a user submits the website form, creates and confirms Payment Intent
on Stripe.
The metadata attached to Stripe request in JSON format allows passing data for records creation in Salesforce. Please see the supported metadata keys:
Salesforce Flow
Salesforce Flow Handler manages the following records:
Contact
metadata.contact
is used to map Contact details (any standard or custom field can be mapped)LastName
is mandatoryDeduplicate using SF active matching rules (dup rule should bypass sharings)
Organisation
metadata.organisation
is used to map Organisation details (any standard or custom field can be mapped)Name
is mandatory. Otherwise, Account creation is skipped.Deduplicate using SF active matching rules (dup rule should bypass sharings)
Campaign
metadata.campaign
is used to map Campaign details. Any standard or custom filed can be mapped.if no
metadata.campaign
or nometadata.campaign.name
provided then Campaign is skippedThe flow will be trying to find an existing Campaign by Name (
metadata.campaign.name
). Otherwise, a new record will be created.
Opportunity
Name
:Donation
- should be renamed by NPSP Opportunity namingRecord Type
: Donation (npsp_plus_dres
namespace)StageName
:paymentIntent.status == 'succeeded' ? 'Closed Won' : 'Closed Lost'
Amount
:paymentIntent.amount
CloseDate
:paymentIntent.created
npsp__Primary_Contact__c
: the contact created from metadataAccount
: the organisation created from metadata, otherwise a Contact.Account i.e. Household that managed by NPSP.CampaignId
: Campaign record provided above OR NULLmetadata.donation
is used to map Opportunity details. Any standard or custom filed can be mapped excluding the general fields described above populated from Payment Intent.Any field can be populated on Opportunity passing the API name and value.
Payment
npe01__Paid__c
:Opportunity.StageName == Closed Won
npe01__Payment_Date__c
:Opportunity.ClosedDate
npsp_plus__Gateway_Transaction_ID__c
:paymentIntent.id
npe01__Payment_Method__c
:Credit Card
metadata.payment
is used to map Payment details. Any standard or custom filed can be mapped excluding the general fields described above that populated from Payment Intent.
Example
Example of Stripe Payment Intent creation request (NodeJS):
const paymentIntent = await stripe.paymentIntents.create({
amount: 2000,
currency: 'aud',
payment_method_types: ['card'],
metadata: {
'npsp_plus_contact': '{"FirstName":"Stephen","LastName":"Kent","Email":"developer+sk@vertic.com.au","MailingStreet":"test","MailingCity":"test","Birthdate":"1990-10-22"}'
'npsp_plus_organisation': '{"Name":"Vertic"}',
'npsp_plus_donation': '{"LeadSource":"Web"}',
'npsp_plus_payment': '{}',
'npsp_plus_campaign': '{"Name":"Web Donations"}'
}
});