Comments (15)
Hello @tvadalia
For now,
You can read more information about how to integrate our service via https://docs.omise.co/ only.
We will add more example and practice code into omise-php lib soon!
For you
Collecting a card details
https://docs.omise.co/collecting-card-information/
noted: For best practice, use Omise-js (with Jquery) from client side to collect customer card information, we will create some Token
for you, then use Charge API from server side to charge a card from your customer card. For more information please click the link above
Charging the payment
https://docs.omise.co/charging-cards/
Thanks for your interest.
Guzzilar
from omise-php.
Hi Guzzilar,
Thanks for sharing the detalis.
Couple of points:
I tried attach sample file provided in the link. One is to generate token
but when it generate token it seems there is no way to get token details
back. If so then how do we proceed with payment?
Omise.createToken("card", card, function (statusCode, response)
{
if (response.object == "error") {
// Display an error message.
$("#token_errors").html(response.message);
// Re-enable the submit button.
form.find("input[type=submit]").prop("disabled", false);
} else {
// Then fill the omise_token.
form.find("[name=omise_token]").val(response.id);
// And submit the form.
form.get(0).submit();
};
});
Other is pay now:
If We want to use that directly can you please let me know test security
key and expiration details which can be use with Credit card ID :
42424242424242
Regards,
Tejas
On Sun, Apr 5, 2015 at 5:47 PM, Nuttanon Trapnirundon <
[email protected]> wrote:
Hello @tvadalia https://github.com/tvadalia
For now,You can read more information about how to integrate our service via
https://docs.omise.co/ only.
We will add more example and practice code into omise-php lib soon!
For youCollecting a card details
https://docs.omise.co/collecting-card-information/
noted: For best practice, use Omise-js
https://github.com/omise/omise.js (with Jquery
https://github.com/jquery/jquery) from client side to collect customer
card information, we will create some Token for you, then use Charge API
https://docs.omise.co/api/charges/ from server side to charge a card from
your customer card. For more information please click the link aboveCharging the payment
https://docs.omise.co/charging-cards/Thanks for your interest.
Guzzilar—
Reply to this email directly or view it on GitHub
#8 (comment).
Tejas Vadalia
Cell: +919820984387
[email protected], [email protected]
from omise-php.
Hi,
Regarding the test number, you can use any CVC and expiration date for the test card in test mode. It will be considered valid if expiration date is later than the current date. There are few numbers that could be used in test, please see test card section in the documentation.
For creating a payment, normally you will have to use Omise.js to tokenize the card detail via JavaScript in HTML form (or Omise-Android/Omise-iOS if you're building native app.)
In the Omise.js, you can retrieve a token information via response
. You will want to pass response.id
to a hidden field in a form and re-submit it to your server for further processing. In summary, the flow is usually:
- In the frontend: tokenize the card and submit
response.id
(token id) to the backend. - In the backend: use the submitted
response.id
to create customer and/or create a charge.
For the (1) please see example.html for a detailed example. For (2) if you submit the token to your server as token
parameter (e.g. $_POST['token']
), then to make a charge, you would do something similar to this in your backend code:
<?php
$charge = OmiseCharge::create(array(
'amount' => 100000,
'currency' => 'thb',
'card' => $_POST['token']
));
Please note that amount
must be in Satang. You can check whether the charge went successfully or not by checking $charge['authorized'] && $charge['captured']
which should both be true in case the charge was successful.
We're looking to improve our documentation in couple of weeks. Stay tuned!
from omise-php.
Hi,
This is great. Can you please also share an example of charging card with
return URL after accepting token value. That will help give end to end
example.
Regards,
Tejas
On Sun, Apr 5, 2015 at 11:34 PM, Kridsada Thanabulpong <
[email protected]> wrote:
@tvadalia https://github.com/tvadalia
Hi,
Regarding the test number, you can use any CVC and expiration date for the
test card in test mode. It will be considered valid if expiration date is
later than the current date. There are few numbers that could be used in
test, please see test card https://docs.omise.co/api/tests/ section in
the documentation.For creating a payment, normally you will have to use Omise.js
https://docs.omise.co/omise-js/ to tokenize the card detail via
JavaScript in HTML form (or Omise-Android
https://github.com/omise/omise-android/Omise-iOS
https://github.com/omise/omise-ios if you're building native app.)In the Omise.js, you can retrieve a token information via response. You
will want to pass response.id to a hidden field in a form and re-submit
it to your server for further processing. In summary, the flow is usually:
- In the frontend: tokenize the card and submit response.id (token
id) to the backend.- In the backend: use the submitted response.id to create customer
and/or create a charge.For the (1) please see example.html
100000, 'currency' => 'thb', 'card' => $_POST['token'])); Please note that amount must be in Satang. You can check whether the charge went successfully or not by checking $charge['authorized'] && $charge['captured'] which should both be true in case the charge was successful. We're looking to improve our documentation in couple of weeks. Stay tuned! — Reply to this email directly or view it on GitHub https://github.com//issues/8#issuecomment-89822105.
https://github.com/omise/omise.js/blob/5c816e9fc50d7585e8855f73e57ddcd6682cb7d1/examples/index.html
for a detailed example. For (2) if you submit the token to your server as
token parameter (e.g. $_POST['token']), then to make a charge, you would
do something similar to this in your backend code:
Tejas Vadalia
Cell: +919820984387
[email protected], [email protected]
from omise-php.
@tvadalia There was a return_uri
attribute for a charge. But it has been deprecated now. So you might have to handle url redirect within your code, with php http_redirect()
for instance.
from omise-php.
Hi,
Thanks for the update. I was actually looking on example of passing token
to charge credit card. Is it possible to share one example that can help.
Regards,
Tejas
On Tue, Apr 7, 2015 at 9:01 AM, Di Warachet [email protected]
wrote:
@tvadalia https://github.com/tvadalia There was a return_uri attribute
for a charge. But it has been deprecated now. So you might have to handle
url redirect within your code, with php http_redirect() for instance.—
Reply to this email directly or view it on GitHub
#8 (comment).
Tejas Vadalia
Cell: +919820984387
[email protected], [email protected]
from omise-php.
@tvadalia
You could check that out in https://docs.omise.co/api/charges/ and see illustrated PHP code example in "charge a card using token"
That said, you can pass the token as card
attribute, like so:
$charge = OmiseCharge::create(array(
'amount' => 100000,
'currency' => 'thb',
'card' => 'tokn_test_4xs9408a642a1htto8z'
));
from omise-php.
Hi,
I tried following approach but it's failing. Please advise:
<script>
(function($, window, undefined) {
"use strict";
$(document).ready(function () {
// The public key could be found in Omise Dashboard. You must set
// the public key before calling Omise.createToken otherwise
// it will result in authentication error.
Omise.setPublicKey("pkey_test_4z71v4cxi9f9h52dvcs");
// When the card form is submitted, we call Omise.createToken to
// turn the card information to one-time token.
$("#card").submit(function() {
// Create a token with Omise. Form data is retrieved from
data-omise
// set in attribute. Please note that it is important
that
// form inputs DO NOT have "name" attribute.
Omise.createToken("card", {
"name": $("[data-omise=card_name]").val(),
"number": $("[data-omise=card_number]").val(),
"expiration_month": $("[data-omise=card_expm]").val(),
"expiration_year": $("[data-omise=card_expy]").val(),
"security_code": $("[data-omise=security_code]").val()
}, function(statusCode, response) {
// This callback will be called regardless of token creation
// was success or not. You may check the status of token
// creation with statusCode or by checking response.object.
//
// In case of an error, an "error" object will be returned.
// The error messages are retrieveable from response.message
// in such case.
//
// In an actual credit card form, you will want to store the
// token id in a hidden form field and submit it to your web
// server for further processing.
alert(response.code+": "+response.message +"==>"+ response.id)
if (response.object == "token") {
$("#response").html(response.id);
} else {
$("#response").html(response.code+": "+response.message)
};
// document.card.token.value = response.id
});
omise.charges.create({
'amount': '100000',
'currency': 'thb',
'card': 'tokn_test_4xs9408a642a1htto8z'
}, function(err, charge) {
/**/
});
// Skip submitting form.
return false;
});
});
})(jQuery, window);
</script>
Regards,
Tejas
On Tue, Apr 7, 2015 at 10:58 AM, Di Warachet [email protected]
wrote:
@tvadalia https://github.com/tvadalia
You could check that out in https://docs.omise.co/api/charges/ and see
illustrated PHP code example in "charge a card using token"That said, you can pass the token as card attribute, like so:
$charge = OmiseCharge::create(array(
'amount' => 100000,
'currency' => 'thb',
'card' => 'tokn_test_4xs9408a642a1htto8z'
));—
Reply to this email directly or view it on GitHub
#8 (comment).
Tejas Vadalia
Cell: +919820984387
[email protected], [email protected]
from omise-php.
@tvadalia Could you tell me more about your error or failed message that you have received?
Regards,
Guzzilar
from omise-php.
Hi,
Functionality is not working to charge card. Please find the attached file.
Please help to understand what is wrong.
Also, I tried submitting forms directly to https://api.omise.co/charges but
even that fails with message stating Authentication Failed.
Regards,
Tejas
On Sat, Apr 11, 2015 at 11:01 PM, Nuttanon Trapnirundon <
[email protected]> wrote:
@tvadalia https://github.com/tvadalia Could you tell me more about your
error or failed message that you have received?Regards,
Guzzilar—
Reply to this email directly or view it on GitHub
#8 (comment).
Tejas Vadalia
Cell: +919820984387
[email protected], [email protected]
from omise-php.
Hi @tvadalia
From your code
omise.charges.create({
'amount': '100000',
'currency': 'thb',
'card': 'tokn_test_4xs9408a642a1htto8z'
}, function(err, charge) {
/**/
});
This line should move into Back-end
layer, not Front-end
.
After Omise.createToken
return some token to you, you should append this token back to your form,
something like
<form id="your-form">
<input type="hidden" name="omise_token">
</form>
$('#your-form').find("[name=omise_token]").val(the_token);
and re-submit your form again like
$('#your-form').submit();
So, everything I said in above should be done in (from your code)...
Omise.createToken("card", {
"name": $("[data-omise=card_name]").val(),
"number": $("[data-omise=card_number]").val(),
"expiration_month": $("[data-omise=card_expm]").val(),
"expiration_year": $("[data-omise=card_expy]").val(),
"security_code": $("[data-omise=security_code]").val()
}, function(statusCode, response) {
// ... HERE :)
});
This's how to collect your customer card in Front-end
layer.
For charge a card please look at link https://docs.omise.co/charging-cards/
and It should code in Back-end
layer side (this's mean in PHP
language, not Javascript
)
Regards,
Guzzilar
from omise-php.
Hi,
While using Payment gateway am getting below error:
Token was not found.
Please access below URL and click submit will throw the exception.
https://www.guest2go.com/hotel/payment/index.php
Could you please help me understand what is missing.
Regards,
Tejas
On Mon, May 11, 2015 at 11:27 AM, Robin Clart [email protected]
wrote:
—
Reply to this email directly or view it on GitHub
#8 (comment).
Tejas Vadalia
Cell: +919820984387
[email protected], [email protected]
from omise-php.
Hi,
Could you give me some part of your code inside try { } catch() { }
block ?
Regards,
Nam
from omise-php.
Please find the attached file. Checkout.php has the code.
Regards,
Tejas
On Fri, Oct 9, 2015 at 12:05 AM, Nuttanon Trapnirundon <
[email protected]> wrote:
Hi,
Could you give me some part of your code inside try { } catch() { } block
?Regards,
Nam—
Reply to this email directly or view it on GitHub
#8 (comment).
Tejas Vadalia
Cell: +919820984387
[email protected], [email protected]
from omise-php.
Hi,
Could you please send it again to our support email ([email protected]) ?
Sorry for your inconvenience.
Regards,
Nam
from omise-php.
Related Issues (20)
- Omise Unit Tests Clashing With Laravel Unit Tests HOT 2
- Certificates file is several years old HOT 2
- Not receiving webhook for charges HOT 3
- Magento Checkout cart error HOT 1
- [Question] How to pass custom CURLOPT option HOT 2
- Live server issue HOT 7
- method OmiseCardList@retrieve use empty key HOT 1
- The bug related to storing keys in a singleton pattern. HOT 1
- Wrong OMISE_PHP_LIB_VERSION version in release tag v2.12.0 HOT 1
- Add a programmatic way to check whether the 3D Secure validation is enabled for a given Omise account HOT 3
- Provide the public access to the OmiseObject::$_values array at the whole with a method like getValues() HOT 4
- This library needs more love HOT 11
- Proposal for 3-0-0 design HOT 3
- How to get authorize_uri form $_values after call api charge HOT 3
- Some PHP hosting with curl can't use omise-lib HOT 3
- OmiseCardList::Count() works incorrect HOT 7
- api version HOT 2
- How to store Customer IDs? HOT 6
- Proposal: implement extension for Omnipay HOT 3
- omise-php should set CURLOPT_SSLVERSION to prevent TLS 1.1 request on some platform. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omise-php.