-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style(card-demo): Cleaning up the card demo (#904)
- Loading branch information
Showing
1 changed file
with
47 additions
and
84 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,63 @@ | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<div id="paypal-button"></div> | ||
|
||
<script src="http://localhost.paypal.com:9000/checkout.js"></script> | ||
<!-- <script src="https://hermesnodeweb18015753.qa.paypal.com/webapps/hermes/static/js/checkout.js" data-paypal-checkout data-log-level="debug" data-env="stage" data-stage="hermesnodeweb18015753" data-api-stage="msmaster"></script> --> | ||
<script src="https://www.paypalobjects.com/api/checkout.js"></script> | ||
|
||
<script> | ||
paypal.Button.render({ | ||
paypal.Button.render({ | ||
|
||
env: 'local', // Optional: specify 'sandbox' environment | ||
// env: 'stage', // Optional: specify 'sandbox' environment | ||
env: 'sandbox', // Optional: specify 'sandbox' environment | ||
|
||
locale: 'en_JP', | ||
// locale: 'en_SG', | ||
// locale: 'en_US', | ||
// locale: 'ar_YE', | ||
// locale: 'fr_FR', | ||
locale: 'en_US', | ||
|
||
commit: true, // Optional: show a 'Pay Now' button in the checkout flow | ||
commit: true, // Optional: show a 'Pay Now' button in the checkout flow | ||
|
||
style: { | ||
branding: true, // optional | ||
layout: 'vertical', | ||
size: 'large', // small | medium | large | responsive | ||
shape: 'rect', // pill | rect | ||
color: 'gold' // gold | blue | silve | black | ||
}, | ||
|
||
client: { | ||
sandbox: 'AWi18rxt26-hrueMoPZ0tpGEOJnNT4QkiMQst9pYgaQNAfS1FLFxkxQuiaqRBj1vV5PmgHX_jA_c1ncL', | ||
stage: 'alc_client1', | ||
local: 'alc_client1' | ||
}, | ||
|
||
payment: function(data, actions) { | ||
|
||
var env = this.props.env; | ||
var client = this.props.client; | ||
style: { | ||
branding: true, // optional | ||
layout: 'vertical', | ||
size: 'large', // small | medium | large | responsive | ||
shape: 'rect', // pill | rect | ||
color: 'gold' // gold | blue | silve | black | ||
}, | ||
|
||
var transactions = [ | ||
{ | ||
amount: { total: '3.00', currency: 'USD' }, | ||
"item_list": { | ||
"items": [ | ||
{ | ||
"name": "hat", | ||
"description": "Brown hat.", | ||
"quantity": "1", | ||
"price": "3", | ||
"sku": "1", | ||
"currency": "USD" | ||
}, | ||
] | ||
} | ||
client: { | ||
sandbox: 'AWi18rxt26-hrueMoPZ0tpGEOJnNT4QkiMQst9pYgaQNAfS1FLFxkxQuiaqRBj1vV5PmgHX_jA_c1ncL', | ||
stage: 'alc_client1', | ||
local: 'alc_client1' | ||
}, | ||
]; | ||
|
||
var payer = { | ||
payer_info: { | ||
email: "khang.hoang12123123123213@pp.com", | ||
// first_name: "khang", | ||
// last_name: "hoang", | ||
// billing_address: { | ||
// state: "Tokyo", | ||
// line1: "2702394 Calista Court", | ||
// city: "Tokyo", | ||
// postal_code: "1600000", | ||
// country_code: "JP", | ||
// phone: "669-215-8030" | ||
// }, | ||
// billing_address: { | ||
// state: "CA", | ||
// line1: "2702394 Calista Court", | ||
// city: "San Jose", | ||
// postal_code: "95111", | ||
// country_code: "US", | ||
// phone: "669-215-8030" | ||
// }, | ||
} | ||
} | ||
payment(data, actions) { | ||
const transactions = [ | ||
{ | ||
amount: { | ||
total: '3.00', | ||
currency: 'USD' | ||
}, | ||
item_list: { | ||
items: [ | ||
{ | ||
name: 'Hat', | ||
description: 'A stylish brown hat.', | ||
quantity: '1', | ||
price: '3.00', | ||
sku: '12345', | ||
currency: 'USD' | ||
}, | ||
] | ||
} | ||
} | ||
]; | ||
|
||
return actions.payment.create({ | ||
payment: { transactions } | ||
}); | ||
}, | ||
|
||
return actions.payment.create({ | ||
payment: { | ||
transactions: transactions, | ||
payer: payer, | ||
onAuthorize(data, actions) { | ||
actions.payment.execute().then(data => { | ||
// Show a success page to the buyer | ||
}); | ||
} | ||
}); | ||
}, | ||
|
||
onAuthorize: function(data, actions) { | ||
|
||
console.log(data, actions); | ||
actions.payment.execute().then(function(data) { | ||
console.log(data); | ||
// Show a success page to the buyer | ||
}); | ||
} | ||
|
||
}, '#paypal-button'); | ||
}, '#paypal-button'); | ||
</script> |