Skip to content
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

trying to add youcan payment to my personal site #31

Open
ayoubel-svg opened this issue May 7, 2023 · 1 comment
Open

trying to add youcan payment to my personal site #31

ayoubel-svg opened this issue May 7, 2023 · 1 comment

Comments

@ayoubel-svg
Copy link

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
Copy link

agounane commented Dec 4, 2023

Looks like you shared your private keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants