Skip to content

Commit

Permalink
Update payments_generator.py
Browse files Browse the repository at this point in the history
Edit comments
  • Loading branch information
Jgerardopine authored Feb 16, 2024
1 parent d6f252f commit c197b07
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
# To create a new payment: python script_name.py create
# To update an existing product:
# python script_name.py update PAYMENT_ID '[{"op": "replace", "path": "/transactions/0/amount", "value": {"total": "50.00", "currency": "USD"}}]'
#
# NOTE: This is version does not work for CREATE PAYMENT as the HEADER requires data I can't get
#
# Ypu may need to add a security context, but you need the proper set of permissions in your account to be able to send this context
#security_context = '{"actor":{"account_number":"<ACCOUNT_ID>","party_id":"<PARTY_ID>","auth_claims":["AUTHORIZATION_CODE"],"auth_state":"ANONYMOUS","client_id":"zf3..4BQ0T9aw-ngFr9dm....Zx9D-Lf4"},"auth_token":"<YOUR_TOKEN>","auth_token_type":"ACCESS_TOKEN","last_validated":1393560555,"scopes":["https://api-m.sandbox.paypal.com/v1/payments/.*","https://api-m.sandbox.paypal.com/v1/vault/credit-card/.*","openid","https://uri.paypal.com/services/payments/futurepayments","https://api-m.sandbox.paypal.com/v1/vault/credit-card","https://api-m.sandbox.paypal.com/v1/payments/.*"],"subjects":[{"subject":{"account_number":"<ACCOUNT_ID>","party_id":"<PARTY_ID>","auth_claims":["PASSWORD"],"auth_state":"LOGGEDIN"}}]}'


import base64
Expand Down Expand Up @@ -83,7 +87,6 @@ def main():
client_id = CREDS.get("client_id")
secret_id = CREDS.get("client_secret")
token = get_paypal_token(client_id, secret_id)
# security_context = '{"actor":{"account_number":"MDXWPD67GEP5W","party_id":"1659371090107732880","auth_claims":["AUTHORIZATION_CODE"],"auth_state":"ANONYMOUS","client_id":"zf3..4BQ0T9aw-ngFr9dmOUZMwuKocrqe72Zx9D-Lf4"},"auth_token":"A015QQVR4S3u79k.UvhQ-AP4EhQikqOogdx-wIbvcvZ7Qaw","auth_token_type":"ACCESS_TOKEN","last_validated":1393560555,"scopes":["https://api-m.sandbox.paypal.com/v1/payments/.*","https://api-m.sandbox.paypal.com/v1/vault/credit-card/.*","openid","https://uri.paypal.com/services/payments/futurepayments","https://api-m.sandbox.paypal.com/v1/vault/credit-card","https://api-m.sandbox.paypal.com/v1/payments/.*"],"subjects":[{"subject":{"account_number":"2245934915437588879","party_id":"2245934915437588879","auth_claims":["PASSWORD"],"auth_state":"LOGGEDIN"}}]}'

if sys.argv[1] == "create":
payment = create_payment(token, security_context)
Expand All @@ -101,5 +104,3 @@ def main():

if __name__ == "__main__":
main()

#'[{"op": "replace", "path": "/transactions/0/amount", "value": {"total": "25000.00", "currency": "BTC"}}]'

0 comments on commit c197b07

Please sign in to comment.