-
-
Notifications
You must be signed in to change notification settings - Fork 9
URW-180 PayPal API #162
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
Open
Kenneth-W-Chen
wants to merge
48
commits into
develop
Choose a base branch
from
URW-180-Paypal-API
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
URW-180 PayPal API #162
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… lot of this may be unnecessary)
…sses. Minor changes to PHPDocs
…irm_order (unused) Refactoring, created PayPalApplicationContext class, adjusted some error logging
Catch error from send_request in create_order
Fixed issue with create_order that threw an unexpected error
There's a way to verify webhook events without PayPal's API, but it does require PayPal's certificate. Is there a folder we store certs in already or should I store it in a new folder? |
…ayPal transaction items
Kenneth-W-Chen
commented
Sep 7, 2024
Kenneth-W-Chen
commented
Sep 7, 2024
Kenneth-W-Chen
commented
Sep 7, 2024
I stopped having fun about 30 minutes ago |
Changed some PHPDocs
Me having fun now |
Receipt email is only sent once now. Removed $fields parameter from get_order_info since you can only filter for "payment_source" (which only returns the order ID). Added variant_name to paypal_items table. Added variant stuff to the order creation process Added function to tell if a webhook event is sandbox. Stopped webhook handler from trying to capture payment we already marked as captured Made a new payment button function for when the page has static info on the order (i.e., Printful products and dues page during the Spring) Moved the IPN handlers to webhook/handlers/
I should've made the commit message for f58829b say "Fixed some stuff" |
Minor bug fixes
Email receipt Discord message now puts the email body in a separate html file Minor comment changes/removals
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
PayPalCustomApi
(paypal.php
) serves as an intermediary for the API. Currently implements getting an OAuth token, creating orders, getting order details, and capturing payment.paypal/api-json-objects.php
)/paypal/get-order
which sets theLocation
header to the PayPal checkout link./paypal/event-notify
.webhook/handlers
. The functionality remains mostly the same.Missing functionalities (won't be added in this ticket)
orders
andwebhooks
orders
:Update Orders
,Confirm the Order
,Authorize payment for order
,Add tracking information for an Order
,Update or cancel tracking information for a PayPal Order
.webhooks
: everything exceptVerify webhook signature
./merch/buy/complete
page becauseOther changes
config.php
PAYPAL_SANDBOX_API_CLIENT_ID
,PAYPAL_SANDBOX_API_SECRET_KEY_1
,PAYPAL_SANDBOX_API_ACCOUNT
,PAYPAL_SANDBOX_API_PASSWORD
,PAYPAL_SANDBOX_API_SIGNATURE
, andPAYPAL_SANDBOX_WEBHOOK_ID
pointer-events: none
from.paypal-button-overlay
for the PayPal button since the button is now an actual button/template/functions/paypal.php
.Testing
PayPalCustomApi
functionalityPayPalWebhookEvent
functionality/merch/product
and functioninsert_paypal_item()
)Order process (flowchart updated 10/11/2024)
API minor notes
capture_payment
does not need to be filled out in this case (although you still need to pick a payment source [e.g., PayPal or Apple Pay]).Receipt notes
Usage
Create orders
Create a
PayPalCustomApi
object and callcreate_order()
with the appropriate arguments. The response is JSON-encoded string with the order ID, status, and links to checkout and do other things.Example response:
Capture payments
Call this function on an order ID after the payer has approved payment.
You should check the
status
field returned by the capture request. Specifically, you wantCOMPLETED
. See the docs for more details.Get order info
Call this on an order ID to get information on the order from PayPal.
The result will be a JSON-encoded string. It's a bit long, so I'm not including a sample here.
Creating a payment button
text to display
is the text displayed on the button. All letters will be capitalized.$items
is an array of the items to send. The format for all implemented types is shown.input#paypal-items<index><key>
e.g.,input#paypal-items0full_year
return/page/uri
is the page to return the user to upon completing (approving) the order. This is relative to the website's server name (e.g., www.untrobotics.com)cancel/page/uri
is the page to return the user to upon cancelling the order. It follows the same rules asreturn/page/uri
To-do