Skip to content

Manage Payment

Payment methods are managed with Stripe. The Stripe Payment Element is used to collect payment information. The payment information is handled by Stripe and is not sent through or stored in Motiva’s system.

The process to collect payment information is as follows:

  1. Collect payment information with the Payment Element.
  2. Create a setup intent.

    Create Setup Intent Mutation
    mutation CreateSetupIntent($input: CreateSetupIntentInput) {
    createSetupIntent(input: $input) {
    clientSecret
    setupIntentId
    customerId
    ephemeralKey
    }
    }
    input CreateSetupIntentInput
    {
    contractType: PaymentMethodContractType
    }
    enum PaymentMethodContractType
    {
    LEASE # Allows only debit, ACH payments
    SUBSCRIPTION # Allows only credit payments
    ALL # Allows all payment methods
    }
  3. Confirm the setup intent with the returned clientSecret.

    Confirm Setup Intent (Stripe SDK)
    // Confirm the SetupIntent using the details collected by the Payment Element
    const {error} = await stripe.confirmSetup({
    elements,
    clientSecret,
    confirmParams: {
    return_url: 'https://example.com/complete',
    },
    });
    if (error) {
    // This point is only reached if there's an immediate error when
    // confirming the setup. Show the error to your customer (for example, payment details incomplete)
    handleError(error);
    } else {
    // Your customer is redirected to your `return_url`. For some payment
    // methods like iDEAL, your customer is redirected to an intermediate
    // site first to authorize the payment, then redirected to the `return_url`.
    }