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

retrieve payment URL for using in API or external usages #29

Closed
mvonline opened this issue Dec 16, 2019 · 2 comments
Closed

retrieve payment URL for using in API or external usages #29

mvonline opened this issue Dec 16, 2019 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mvonline
Copy link

Hi
You implement getPaymentUrl as a protected method (Zarinpal Driver in my case).
In some implementation developers need to pass the full payment URL to client Side (maybe Vue) via API and redirect from client Browser.

is there any way to change getPaymentUrl as a public method ?

@khanzadimahdi
Copy link
Member

you can retrieve URL like the below:

dd($payment->callbackUrl($url)->pay()->getTargetUrl()); // shows the url

@khanzadimahdi khanzadimahdi added the help wanted Extra attention is needed label Dec 16, 2019
@khanzadimahdi khanzadimahdi pinned this issue Dec 17, 2019
@khanzadimahdi khanzadimahdi changed the title getPaymentUrl as a public method retrieve payment URL for using in API or external usages Dec 17, 2019
@khanzadimahdi
Copy link
Member

in version 3+ you should get redirection form or JSON (for api usage) like the below

// in your restful api

dd($payment->callbackUrl($url)->pay()->toJson()); // shows the url and fields information

or if you want to redirect user in browser, run the below code

return $payment->callbackUrl($url)->pay()->render();

@khanzadimahdi khanzadimahdi added the enhancement New feature or request label Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants