trying to add youcan payment to my personal site
Opened this issue · 1 comments
ayoubel-svg commented
why i don't get any response this the code :
useKeys('pri_9fb67306-af64-449f-bacf-18a556f3', 'pub_a01b7b41-0e42-4a56-a165-1bc55244'); // Data of the customer who wishes to make this purchase. // Please keep these keys. $customerInfo = [ 'name' => '', 'address' => '', 'zip_code' => '', 'city' => '', 'state' => '', 'country_code' => '', 'phone' => '', 'email' => '', ]; $metadata = [ // Can you insert what you want here... //'key' => 'value' ]; $token = $youCanPay->token->create( "order-id", "1000", "USD", "123.123.123.123", "https://yourdomain.com/orders-status/success", "https://yourdomain.com/orders-status/error", $customerInfo, $metadata ); return $token->getId(); } } ?><script type="text/javascript">
// Create a YouCan Pay instance.
const ycPay = new YCPay(
"pub_a01b7b41-0e42-4a56-a165-1bc55244", {
formContainer: "#payment-card",
locale: "en",
isSandbox: true,
errorContainer: "#error-container",
}
);
ycPay.renderCreditCardForm();
</script>
<script type="text/javascript">
document.getElementById("pay").addEventListener("click", function() {
// Execute the payment, it is required to put the created token in the tokenization step.
ycPay
.pay("<?php (new ExamplePayment())->createToken() ?>")
.then(successCallback)
.catch(errorCallback);
});
function successCallback(transactionId) {
alert("success");
}
function errorCallback(errorMessage) {
alert("faild");
}
</script>
agounane commented
Looks like you shared your private keys