Skip to content

Commit

Permalink
style(card-demo): Cleaning up the card demo (#904)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcntsh authored and Daniel Brain committed Oct 23, 2018
1 parent f06e4b5 commit 654bf55
Showing 1 changed file with 47 additions and 84 deletions.
131 changes: 47 additions & 84 deletions demo/card.htm
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&#45;paypal&#45;checkout data&#45;log&#45;level="debug" data&#45;env="stage" data&#45;stage="hermesnodeweb18015753" data&#45;api&#45;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>

0 comments on commit 654bf55

Please sign in to comment.