makePayment
Starts a payment.
The method works only if user already saved billing address. It should be called from onSubmit hook of Adyen Drop-in. It communicates with the makePayment endpoint of the Vue Storefront API Middleware. In turn, it calls the POST /payments Adyen endpoint indirectly via commercetools, using Adyen commercetools.
Signature
export declare function makePayment(
props: MakePaymentParams,
options?: MethodOptions
): Promise<import("@adyen/api-library/lib/src/typings/checkout/paymentResponse").PaymentResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | MakePaymentParams | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
options | Optional | MethodOptions | Options that can be passed to additionally configure the request or customize the logic in a plugin. |
Returns
Returns Promise<MakePaymentResponse>
Referenced Types
- MakePaymentParams
- MethodOptions
PaymentResponse
Examples
Starts a payment. For full context, check the Alokai's documentation.
import { sdk } from '~/sdk.config.ts';
// ... Inside adyenConfiguration.onSubmit property passed in object to the mountPaymentElement SDK method call
const result = await sdk.adyen.makePayment({
paymentId: getPaymentMethodsResponse.payment.id,
componentData: state.data,
...(balanceCheckResponse?.resultCode === 'NotEnoughBalance'
? {
balance: balanceCheckResponse.balance,
}
: {}),
});
balanceCheckResponse = null;