stripe-react-native
stripe-react-native copied to clipboard
feat: :zap: Update payment details after calling initPaymentSheet
Summary
- created a new function "updatePaymentSheet" which updates the intent config info (e.g. amount) after payment sheet is initialized
Motivation
updating payment sheet intent config, is needed for payment methods that requires second level of authentication. so the amount can be displayed correctly on the 3rd party authentication. the functionality already exists in IOS and android native code. the PR is to expose the same in react native sdk.
Testing
- [X] I tested this manually
- [ ] I added automated tests
Documentation
new screen updated in the example app to test the scenario.
step 1
in your component, use the hook useStripe to retrieve the new "updatePaymentSheet" function.
const {
updatePaymentSheet,
} = useStripe();
step2
call the updatePaymentSheet with the PaymentSheet.IntentConfiguration object containing all the params
const { error, paymentOption } = await updatePaymentSheet({
confirmHandler: ...,
mode: {
amount: amount,
currencyCode: 'SEK',
},
});
NOTE: the function replace the entier block, so be aware if you remove an attribute it will be removed.
Select one:
- [X] I have added relevant documentation for my changes.
- [X] This PR does not result in any developer-facing changes.
Any update on this pr pls ?