calcom / cal.com

Scheduling infrastructure for absolutely everyone.
https://cal.com
Other
31.77k stars 7.75k forks source link

PayPal App #1546

Closed PeerRich closed 9 months ago

PeerRich commented 2 years ago

collect payments for event-types with PayPal (similar to the existing Stripe Integration)

PeerRich commented 1 year ago

if anyone wants to pick this up, here's how to make an app: https://docs.cal.com/how-to-guides/how-to-build-an-app

PeerRich commented 1 year ago

we now have a new payment adaptor which makes it easier, too

algora-pbc[bot] commented 1 year ago

💎 $200 bounty created by cal 👉 No need to comment asking to work on it. Just open a PR and claim the bounty with /claim #1546 inside the PR 📝 Before proceeding, please make sure you can receive payouts in your country 💵 Payment arrives in your account 2-5 days after the bounty is rewarded 💯 You keep 100% of the bounty award 🙏 Thank you for contributing to calcom/cal.com!

a0m0rajab commented 1 year ago

I did a quick search but did not dive deep, here are few links for my findings:

here is the stripe app: https://github.com/calcom/cal.com/blob/main/packages/app-store/stripepayment And here is the PayPal API: https://developer.paypal.com/docs/api/payments/v1/

AbleLincoln commented 1 year ago

Would this app also be ee only, like how the Stripe payment is?

AbleLincoln commented 1 year ago

I've started diving into this, and some interesting things are coming up.

For example: how do we reconcile if the user has both Stripe and PayPal enabled? Is this something we even allow? Does one take precedence?

Pricing is currently set through the Stripe app gui. Adding another payment app will essentially add another field to set the price, which could cause event-types to have 2 different prices. Could get messy. (Unless we want distinct prices bc the fee structure is different for each platform?)

It looks like price used to just be a column on EventType, but I think it was deprecated in favor of getting that from app metadata. Maybe we switch it back now that we're implementing multiple payment options?

AbleLincoln commented 1 year ago

how do we reconcile if the user has both Stripe and PayPal enabled? Is this something we even allow? Does one take precedence?

Ok I guess I answered my own question here https://github.com/calcom/cal.com/blob/ea676907b21966597021dd45621701f478e19be9/packages/lib/getPaymentAppData.ts#L24

But if this is the case, then how should we indicate to the user that only one of their payment options is going to actually work? As I'm messing around with it now, I'm able to have 2 payment apps running in a single event type. On the booking side, it's handled properly (Stripe gets booted for PayPal). But it's not clear when making the event type that only one is going to work. I think we will need some kind of UI that disables other payment apps when one is turned on.

AbleLincoln commented 1 year ago

@PeerRich is it possible to assign this to me? I've got some parts working already

cnhhoang850 commented 1 year ago

@AbleLincoln wow that's great.

Didn't see this so I got to work on it and got the integration page for onboarding and callback working, but the PayPal REST api requires that your app is registered with PayPal as partner before you can test the URL referral portal. Have you looked into this?

Do you wanna share your progress and work together on this?

AbleLincoln commented 1 year ago

Yeah I'm talking to the PayPal people right now, so we'll see what they say about getting us access.

I kind of did things out of order, so I've got the payment page working but need to slot in the onboarding. I'll push what I have. Want to link your branch and we can collab?

AbleLincoln commented 1 year ago

https://github.com/AbleLincoln/cal.com/tree/feat/paypal-app you can see what I've got so far

alannnc commented 1 year ago

@AbleLincoln Will definitely take a look on your code. Sharing mine as well https://github.com/calcom/cal.com/pull/8797 I've take the route to use a custom button at payment page and use Paypal api on the server just like we do with stripe.

AbleLincoln commented 1 year ago

The solution I have allows the user to enable the payment app just by signing into their PayPal account. No developer account or API credentials required. I feel like this is an easier user experience. You can check out the flow below.

paypal wee

The solution is nearly finished, and I'm already in contact with the PayPal rep that will give us access to move into production. Is this a path we would like to pursue?

alannnc commented 1 year ago

It looks great! Definitely we are always aiming for better user experience. Although we should keep in mind that the app should be available for self hosted users. What is the way to go for self hosted users? Can you share with me the docs from paypal you used for this integration? @AbleLincoln

AbleLincoln commented 1 year ago

Ah that's interesting, I hadn't thought about the self-hosted element. These are the docs I've been referencing. In the case of self-hosting, the user would need to apply for their own marketplace app account on PayPal, which is a bit complicated. In that case then I think using developer api keys makes more sense.

alannnc commented 1 year ago

@AbleLincoln I just got back home from our retreat, one of my priorities this week it's the Paypal app. Did you manage to have a working PR? I'm thinking we could probably have our 2 approaches and the user decide what they wanna use.

alannnc commented 1 year ago

@AbleLincoln We are still reviewing Paypal implementation for Cal.com, were you able to have a working example for OAuth implementation? CC: @joeauyeung

ubinatus commented 1 year ago

Seems issue is already shipped in v3.2.0.

H9660 commented 9 months ago

Is this issue already resolved?