@oneblink/apps-react
    Preparing search index...

    Function createApprovalStepPayment

    • Create a payment for an approval step. Returns the details needed to send the user to the payment provider. When the provider redirects to redirectUrl, the receipt for this payment can be displayed. Throws an OneBlinkAppsError with conflict set to PAYMENT_IN_PROGRESS_CONFLICT when a checkout for this step is already in progress.

      const payment = await approvalsService.createApprovalStepPayment(
      'd27966cc-128d-48a2-b681-6ad52012e113',
      {
      redirectUrl:
      'https://approvals.example/approvals/d27966cc-128d-48a2-b681-6ad52012e113/payment-receipt',
      paymentFormUrl:
      'https://approvals.example/approvals/d27966cc-128d-48a2-b681-6ad52012e113/payment',
      form,
      submissionId: '89c6e98e-f56f-45fc-84fe-c4fc62331d34',
      },
      )

      Parameters

      • formSubmissionApprovalId: string
      • options: {
            form: Form;
            paymentFormUrl?: string;
            redirectUrl: string;
            replacePendingPayment?: boolean;
            submissionId: string;
        }
        • form: Form

          The form definition for this approval.

        • OptionalpaymentFormUrl?: string

          The in-app payment page. Required for providers that render their payment form in the app.

        • redirectUrl: string

          The URL the payment provider redirects to when the payment finishes.

        • OptionalreplacePendingPayment?: boolean

          Cancel a checkout that is already in progress so this payment can start. Leave unset to reject that checkout.

        • submissionId: string

          The submission this approval belongs to.

      • OptionalabortSignal: AbortSignal

      Returns Promise<
          {
              amount: number;
              customerReferenceNumber?: string;
              hostedFormUrl: string;
              paymentSubmissionEvent: FormPaymentEvent;
          },
      >