Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I download payment methods? #195

Open
trendak opened this issue Dec 30, 2020 · 10 comments
Open

How can I download payment methods? #195

trendak opened this issue Dec 30, 2020 · 10 comments

Comments

@trendak
Copy link

trendak commented Dec 30, 2020

I am doing a micro service.

How can i download payment methods?

I don't know if I understood correctly, but when I do authorization it should redirect to the payment gateway.

When i make:
$response = $gateway->authorize([ 'amount' => '10.00', 'currency' => 'USD', 'description' => 'This is a test purchase transaction.', 'returnUrl' => 'http://test.test/web/gateway-return', 'confirm' => true, ])->send();

Then i have error: The source parameter is required

@domis86
Copy link

domis86 commented Dec 30, 2020

https://github.com/thephpleague/omnipay-stripe#stripe-payment-intents

You are missing 'paymentMethod' parameter

@trendak
Copy link
Author

trendak commented Dec 30, 2020

With 'paymentMethod' I have this same.

How can i download payment methods?

@domis86
Copy link

domis86 commented Dec 31, 2020

https://github.com/thephpleague/omnipay-stripe#stripe-payment-intents

$paymentMethod = $_POST['paymentMethodId'];

$response = $gateway->authorize([
     'amount'                   => '10.00',
     'currency'                 => 'USD',
     'description'              => 'This is a test purchase transaction.',
     'paymentMethod'            => $paymentMethod,
     'returnUrl'                => $completePaymentUrl,
     'confirm'                  => true,
 ])->send();

$_POST['paymentMethodId'] is sent from client side - see for example: https://stripe.com/docs/payments/accept-a-payment-synchronously#web-send-to-server - there it is named payment_method_id :

...
    // Otherwise send paymentMethod.id to your server (see Step 4)
    fetch('/pay', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        payment_method_id: result.paymentMethod.id,
      })
...

@trendak
Copy link
Author

trendak commented Dec 31, 2020

How can I download payment methods in php?
I need to download payment methods in backend,
This is a micro service, after downloading the payment methods it will be sent to the application.
It can be done universally so that after changing the gateway, payment methods will be charged?

@domis86
Copy link

domis86 commented Dec 31, 2020

@trendak i think you are confusing some concepts here. First you should read Stripe docs regarding overall payment flow and how PaymentIntents works (and what is "Stripe payment method")

It can be done universally so that after changing the gateway, payment methods will be charged?

If you ask if you will be able to reuse "Stripe payment method" in gateway other than Stripe then the answer is no 😃

@trendak
Copy link
Author

trendak commented Dec 31, 2020

@domis86 I think he misunderstood my questions.

I am doing a micro service based on another one and it must contain the same functionality.

Is it possible to download payment methods in backend?

After selecting the payment method, e.g. a bank, I would like the user to be redirected to his website, and in the case of a card like here:
https://stripe.com/docs/payments/accept-a-payment?integration=elements

If you ask if you will be able to reuse "Stripe payment method" in gateway other than Stripe then the answer is no 😃

That's not what I meant, it would be weird. I am asking if omnipay has such a method.

So that I could download payment methods regardless of the gateway. I want to do a stripe now but want the code in backend to be the same for another gateway.

@judgej
Copy link
Member

judgej commented Dec 31, 2020

OmniPay has a limited set of functionality as standard - authorise, pay, void, fetch payment details, and a few helpers. That's just about it.

Any driver for a specific payment gateway can extend this with gateway-specific features. Be aware that those gateway features won't be portable across other gateway types.

@trendak
Copy link
Author

trendak commented Jan 4, 2021

I only have one question. Does omnipay have a payment method download function?

@domis86
Copy link

domis86 commented Jan 4, 2021

can you define what you mean by "payment method download" ?

@iantearle
Copy link

@trendak It sounds like you want to get the payment method "card number and security details" and use it on another payment gateway?

So that I could download payment methods regardless of the gateway. I want to do a stripe now but want the code in backend to be the same for another gateway.

That's fraud. You're not going to be able to download the payment method, you can poll stripe for the type of card used and the last four digits, but no payment gateway is going to give you the whole details of the card used. #

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants