Skip to content

Stripe

The JustOn Self-Service Extension supports Stripe as a payment provider. It uses the Stripe Webhooks to implement the payment procedure. It uses Stripe Elements to securely accept the customer's payment details.

The payment provider implementation supports the following payment methods:

  • SEPA Direct Debit, with full support for future payments
  • Credit card, with optional support for future payments

    The future payment support depends on the credit card type and is not available with 3D Secure.

  • Alipay, without support for future payments

Note

When using Stripe, be aware that the payment reference string (set in the field Payment Reference on the invoice template) must include at least one letter.

Creating Stripe Account

In order to use Stripe as a payment provider, you need a valid Stripe account. Follow the instructions in Managing Your Account in the Stripe documentation.

For configuring the integration with the JustOn Self-Service Extension, you need the API keys. The API keys are available in the Developers section of the Stripe Dashboard.

In addition, you must create a webhook. The webhook configuration is also available in the Developers section of the Stripe Dashboard.

Use the following values to add a webhook endpoint:

  • URL to be called:

    The URL is made up of the Salesforce Force.com site URL and the path /services/apexrest/ONBSE1/StripeWebhook, like

    https://INSTANCE.secure.force.com/services/apexrest/ONBSE1/StripeWebhook
    

    Make sure to use the site URL. Do not use the domain URL.

    After creating the webhook, click the webhook to reveal the signing secret. It is required for the configuring the Stripe integration.

  • Webhook version: default

  • Filter event: Send all event types, or select the following event types:

    • source.chargeable
    • charge.pending
    • charge.succeeded
    • charge.failed
    • charge.refunded
    • charge.refund.updated

Info

Stripe can use customers as a means to perform recurring charges without the need to prompt users for card or account numbers. The JustOn Self-Service Extension supports Stripe customers, exposing the feature as Future Payments option. For details about using customers for payment, see Saving Cards in the Stripe documentation.

Note

Make sure to enable the Apex class ONBSE1.StripeWebhookHandler in order to support the Stripe integration. For details, see Configuring Apex Class Access Permissions.

Configuring Stripe Integration

To configure the Stripe integration with the JustOn Self-Service Extension:

  1. Open the Payment Provider Setup page.

    Open the Payment Provider Setup page directly, or navigate to Visualforce Pages > PaymentProviderSetup in Setup, and open the preview.

  2. Select the payment provider and click New to create a new configuration, or click Edit next to an existing configuration to modify it.

    You can create one active payment configuration per tenant and payment provider. Before creating a new configuration for a tenant/provider combination that already exists, you must deactivate the existing configuration.

  3. Select the tenants for which the configuration is applicable.

    If there is no tenant selected, this configuration is used by default for all tenants.

  4. Specify a name for this configuration setting.

    Make sure to use a descriptive name that helps to unequivocally identify the configuration setting.

  5. Specify the provider-specific configuration.

    Field Required Notes
    Publishable Key The publishable key of the test or live universe of your account.
    Secret Key The secret key of the test or live universe of your account.
    Webhook Secret The signing secret of the Webhook.
    Enable Future Payments Select this checkbox if you want to enable the future payments feature. When checked, the future payment option is shown after confirming the Stripe payment form, allowing the user to opt for it.
    Future Payments Active Select this checkbox if you want to activate the future payments feature by default. This creates a corresponding payment instrument, which is saved on the account.
    JustOn recommends to activate this setting in combination with Future Payments Changeable to allow users to opt out.
    Future Payments Changeable Select this checkbox if you want users to be able to override the Future Payments Active value in the payment form.
    Be aware that this setting has no effect once users have opted to use future payments. If required or on users' request, you deactivate individual payment instruments manually.
    Alipay Enables payments via Alipay.
    Since Alipay does not support future payments, you must not select the Enable Future Payments option for this payment method. You can, however, use future payments with other Stripe payment methods, and create a separate Stripe configuration for Alipay with future payments disabled.
    Credit Card Enables payments via credit card.
    Enabled by default if no payment method is selected.
    SEPA Enables payments via SEPA direct debit.

    When editing existing configurations, key and secret values are not displayed. Key and secret values remain unchanged as long as you leave the corresponding fields empty.

  6. Select the payment methods for which Stripe is to be used.

  7. Click Add for new configurations or, respectively, Save for existing configurations.

Stripe Refund Handling

Businesses can use JustOn's balance management functionality to directly refund a payment made via Stripe. Based on the Apex Refund Interface, JustOn directly returns the specified amount to the customer and creates a balance record of the type Refund for the account.

Successful Refund Handling

A successful refund handling with Stripe involves the following steps:

  • Since the original payment may have been split into multiple payment balances, JustOn uses the Transaction Number of the original payment to create a list of all related payment balances.
  • The payment balance used to initiate the refund is the first in the list. The other payment balances are sorted by date, with the oldest first.
  • A refund balance is created for each payment in the payment list until the refund amount is used up.
  • A payment balance is always refunded by a related refund balance with the same amount.
  • If the payment balance amount is larger than the remaining refund amount, the payment balance is split.
  • The created refund balances are not linked to an invoice. A refund operation does not change the status of an involved invoice.
  • The created refund balances and the related payment balances are locked, applying the reason Refund via payment provider. Locked balances are exempt from business processes like balance assignment.

    Refund balances can, however, be assigned to open credits.

Info

Usually, you cannot refund an amount that is larger than the original payment amount. If the refund amount is still larger than the sum of the available payment balances, JustOn uses an overrefund to indicate a missing payment balance, and creates an additional payment balance to settle the refund amount. Note that the additional payment balance will not be linked to an invoice.

Failed Refunds

A refund via Stripe can fail if the customer's bank or card issuer has been unable to process the operation correctly, for example, if the bank account has been closed or there was a problem with the card. In the rare instance that a refund fails, JustOn creates a payment entry that includes all relevant information about the failed refund.

Example payment entry for a failed refund:

Field Value
Payment Provider Stripe
Transaction No ch_1ErOvCAL1H03srLS9txxki94
Payment Amount -100,00
Last Error Refund failed: expired_or_canceled_card

Credit and Refund Workflows

The following sections illustrate likely business use cases that combine credit creation with payment refunds. The examples outline the involved steps and show their key results.

Refunding a payment without creating a credit

(1) Finalize invoice

(2) Register payment

(3) Refund payment

refund_uc1
Refunding a registered payment

For additional examples of complete or partial refunds, see Refund Handling Examples.

Refunding a payment with a credit issued before payment receipt

(1) Finalize invoice

(2) Create (partial) credit

(3) Register payment

(4) Refund payment

refund_uc1a
Refunding a registered payment for a partially cleared (reduced) invoice amount

Refunding a payment with a credit issued after payment receipt

(1) Finalize invoice

(2) Register payment

(3) Create (partial) credit

(4) Refund credited amount

(5) Finalize credit

(6) Manually settle open credit with refund balance

refund_uc2
Refunding a registered payment after creating a (partial) credit

Refunding a payment with a credit issued after refund

(1) Finalize invoice

(2) Register payment

(3) (Partially) refund payment

(4) Create (partial) credit

(5) Finalize credit

  • Individually from the detail view: Requires manual settlement with the refund balance using the function Register Payment
  • Via batch process from the list view: JustOn automatically assigns the refund balance upon finalization

refund_uc3
Refunding a registered payment before creating a (partial) credit

Refund Handling Examples

The following section summarizes some examples for the successful refund handling, illustrating its behavior.

Completely refund a single payment

Payment balances

Amount Selected for Refund
-100,00

Resulting refund and payment balances

Type Amount Locked
Payment -100,00
Refund 100,00
Partially refund a single payment

Payment balances

Amount Selected for Refund
-100,00

Resulting refund and payment balances after refunding the amount of 25,00:

Type Amount Locked
Payment -75,00
Payment -25,00
Refund 25,00
Completely refund a split payment

Payment balances

Amount Selected for Refund
-75,00
-25,00

Resulting refund and payment balances after refunding the amount of 25,00;

Type Amount Locked
Payment -75,00
Payment -25,00
Refund 25,00
Partially refund a split payment

Payment balances

Amount Selected for Refund
-75,00
-25,00

Resulting refund and payment balances after refunding the amount of 40,00;

Type Amount Locked
Payment -60,00
Payment -15,00
Payment -25,00
Refund 25,00
Refund 15,00
Refund amount is larger than original payment amount

Payment balances

Amount Selected for Refund
-75,00

Resulting refund and payment balances after refunding the amount of 100,00;

Type Amount Locked
Payment -75,00
Payment -25,00
Refund 75,00
Refund 25,00