useVerifyMicrodepositsForPayment
Verify the customer's bank account of a PaymentIntent with micro-deposits, for ACH Direct Debit and Canadian pre-authorized debits (ACSS). Wraps stripe.verifyMicrodepositsForPayment().
When the customer enters bank details manually, Stripe sends two micro-deposits and the PaymentIntent waits in requires_action (next_action.type: 'verify_with_microdeposits'). Collect the two amounts on a page of your own and verify them here. For a SetupIntent, use useVerifyMicrodepositsForSetup. Must be called within a <VueStripeProvider> or an app that installs createVueStripe().
Usage
<script setup lang="ts">
import { ref } from 'vue'
import { useVerifyMicrodepositsForPayment } from '@vue-stripe/vue-stripe'
const props = defineProps<{ clientSecret: string }>()
const first = ref(32)
const second = ref(45)
const { verifyMicrodepositsForPayment, loading, error } = useVerifyMicrodepositsForPayment()
const verify = async () => {
const { paymentIntent } = await verifyMicrodepositsForPayment(props.clientSecret, {
amounts: [first.value, second.value] // in cents
})
return paymentIntent?.status // 'processing' once verified
}
</script>
<template>
<input v-model.number="first" type="number" />
<input v-model.number="second" type="number" />
<button :disabled="loading" @click="verify">Verify</button>
<p v-if="error">{{ error }}</p>
</template>Return Value
const { verifyMicrodepositsForPayment, loading, error } = useVerifyMicrodepositsForPayment()
// UseStripeMethodReturn<'verifyMicrodepositsForPayment'>| Property | Type | Description |
|---|---|---|
verifyMicrodepositsForPayment | Stripe['verifyMicrodepositsForPayment'] | The Stripe.js method; resolves to { paymentIntent } or { error }. |
loading | Readonly<Ref<boolean>> | true while a call is in flight. |
error | Readonly<Ref<string | null>> | Message of the last call's { error } result or thrown error; reset when a call starts. |
The method resolves to Stripe's result untouched and rejects when Stripe.js throws, after setting error. This is the same behavior as the method confirmers.
Stripe.js signature
verifyMicrodepositsForPayment(
clientSecret: string,
data?: { amounts?: number[] } // VerifyMicrodepositsForPaymentData
): Promise<PaymentIntentResult>Stripe's reference also lists data.descriptor_code, the six-character code starting with SM, and Stripe accepts it at runtime. Stripe.js 10.0.0's VerifyMicrodepositsForPaymentData declares only amounts, so a descriptor_code object literal fails type-checking; widen the type as in Accept ACH Direct Debit.
See Also
- useVerifyMicrodepositsForSetup - The SetupIntent variant
- useFinancialConnections - Collect the bank account
- Payment methods that settle later
- Accept ACH Direct Debit - Verify with micro-deposits
- Live demo
