#Vishal0910-payment-link

1 messages ยท Page 1 of 1 (latest)

weary grove
#

Hello ๐Ÿ‘‹
Juggling between a few threads
Please give me a moment to catch up ๐Ÿ™‚

rapid heath
#

sure

weary grove
#

I'm not sure if its possible to create a payment link with the source API
Are you following a guide or something ?

rapid heath
#

ya i asked it via support they said you can use same reciept_email same like PaymentIntent and Charge

#

but it's not working

#

Do i have to change API ?

#

sorry about you question , yes i am able to create link with Source

weary grove
#

Apologies for the confusion
I'm not sure how you're able to create a link using Source API
can you share your example code and request ID (should look something like req_xxxx) I can take a look at?

rapid heath
#

source = Stripe::Source.create(
type: 'ach_credit_transfer', currency: plan.currency.downcase,
owner: { email: payment_link.student_email }, metadata: payment_link.as_json,
receipt_email: "mdhull07@gmail.com"
)
stripe_link = Stripe::PaymentLink.create(
{
line_items: [
{
price: plan.meta.dig(:provider_id),
quantity: 1,
}
],
billing_address_collection: 'required',
metadata: payment_link.as_json(except: [:meta])
})
ach_details = source.ach_credit_transfer
payment_link.update!(meta: {
link: stripe_link.url, id: stripe_link.id, ach_details: {
account_number: ach_details.account_number,
routing_number: ach_details.routing_number,
fingerprint: ach_details.fingerprint,
swift_code: ach_details.swift_code,
bank_name: ach_details.bank_name,
}
})
StripeSource.find_or_create_by!(owner: payment_link).update!(
source_id: source.id
)

weary grove
#

Ah okay! so you're creating a source first and then creating a payment link. Got it.
What error are you getting?

rapid heath
#

reciept_email is undefined

#

basically i want to send email after succesful payment

#

reciept_email is used in PaymentIntent/charge so can i used it here also or i have to shift api

weary grove
#

ah I see. I don't think that you can set reciept_email on source but let me check something quickly

dry dagger
#

To clarify, you payment link is a shared link and not user/payment specific -- you're linking customer-specififc info in the metadata only so this would be up to you

#

Stripe can send receipts following successful payment if you set that setting in your dashboard

weary grove
#

A heads up that It won't send the email automatically in testmode

rapid heath
#

ok will check

jolly obsidianBOT
#

This thread has been archived. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact

rapid heath
#

hi @weary grove @dry daggeryou have seen above code, if possible can you please suggest alternative stripe api for the same ... i am quite new to stripe api , this task is little time sensitive so difficult to go through whole documentation
which will be best for this case PaymentIntent or Charge

deft hinge
#

catching up here

#

if you're time sensitive, then using PaymentLink is the quickest

#

second is Checkout

#

last is I'd recommend PaymentElement + PaymentIntents, it is most integration intensive

rapid heath
#

ok thanks any demo code would be helpfull