Skip to content

Instantly share code, notes, and snippets.

@callstack-bot
Created June 17, 2022 12:03
Show Gist options
  • Save callstack-bot/a2a09cab4ca5d1b5d4717e8a509de0d5 to your computer and use it in GitHub Desktop.
Save callstack-bot/a2a09cab4ca5d1b5d4717e8a509de0d5 to your computer and use it in GitHub Desktop.
const fetchPaymentIntentClientSecret = async () => {
const response = await fetch(`${API_URL}/create-payment-intent`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
currency: 'usd',
items: [{ id: 'id' }],
}),
});
const { clientSecret } = await response.json();
return clientSecret;
};
const handlePayPress = async () => {
const clientSecret = await fetchPaymentIntentClientSecret();
// step 2
// step 3
// step 4
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment