#Shahana Joy
1 messages · Page 1 of 1 (latest)
request Id means?
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
I mean the one where you see the difference in the amounts
Yes, I took this req_ID from response hear
that's a GET request
but in stripe the amount shown as $46.68
where do you see that?
where in Stripe?
I will create a new and send you.. just a sec
ok
key=pk_test_51HI3HAEFMLOkx7yAWxKt1NHU0733873tuh09SQeL1IzEcOfUtf2AzZ3dAePiKXjsvZ19lL3l6tN9ZmqqBzNTymQ000h9uW3FM3&type=deferred_intent&locale=en-US&deferred_intent[mode]=payment&deferred_intent[amount]=26725&deferred_intent[currency]=usd&referrer_host=localhost%3A4200¤cy=usd
please find this req body
deferred_intent[amount]: 26725
let's stop for a sec
Now I will do the payment with testcard
would you mind sharing your code please
Sure, will wait
would you mind sharing your code please?
sure
let val= 26725
const options = {
mode: 'payment',
amount: Number(val),
currency: 'usd',
paymentMethodCreation: 'manual',
// Fully customizable with appearance API.
appearance: {
theme: 'stripe'
},
layout: "tabs",
variables: {
colorPrimary: '#42bfb5',
colorBackground: '#ffffff',
colorText: '#30313d',
colorDanger: '#df1b41',
fontFamily: 'Segoe UI',
spacingUnit: '2px',
borderRadius: '4px',
// See all possible variables below
}
};
const elements = this.stripe.elements(options);
this.paymentElement = elements.create('payment');
this.paymentElement.mount('#payment-element');
ok so you're using deferred Payment Intents
ok
would you mind sharing your submit code?
sure
const form = document.getElementById('payment-form');
form.addEventListener('submit', async (event) => {
event.preventDefault();
const {error: submitError} = await elements.submit();
if (submitError) {
this.handleError(submitError);
return;
}
const {error, paymentMethod} = await this.stripe.createPaymentMethod({
elements,
params: {
billing_details: {
name: this.nameonCard,
}
}
});
if (error) {
// This point is only reached if there's an immediate error when
// creating the PaymentMethod. Show the error to your customer (for example, payment details incomplete)
this.handleError(error);
return;
}
this.pay(paymentMethod.id,)
});
ok now could you please share the pay function?
pay function is used for our functionality
pay(tokenId: string) {
this.subService.paySubscription.paymentMethodToken = tokenId
this.subService.generatePayment( this.subService.paySubscription).subscribe(response => {
//alert(response);
console.log(response);
let id=sessionStorage.getItem('billingId')
if(response) {
if(response.paymentIntentId){
let reqObj={"RemainingBalance":0,"purchasereceipt":response.paymentIntentId}
this.subService.upadateBillingDetails(reqObj,id).subscribe(response => {
if(response){
this.router.navigate(['successPayment'], {});
}
});
} else {
this.showErrorMsg =true
}
}else {
this.showErrorMsg =true
}
});
}
since you're using the deferred PI, the amount shown there could be different then the one created by the backend
you're just passing the PaymentMethod and doing the payment in the backend
which is really not the best integration path with subscriptions
please refer to this doc for a better understanding of what's the recommended way of integrating with Subscriptions+PaymentElement https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
ohh so you mean it is different because , its done from backend?
the amount is being decided by the backend right?