payment method in commerce I want to make a payment method, that works with web services. I made set of rules that decrease the money from the bank. at last the bank give me a code that it notices whether the payment is successful or not.for example 1 or 0. I want that if the code is 1 for example, Drupal thinks that payment is successful, and when the code is 0, means payment failure. and affect stock to decrease or increase by the returned code. how can I do that? is there any simple sample of on-site payment method ? thanks
This page has everything you need to know, including example payment method modules you can use as reference implementations:

http://www.drupalcommerce.org/developer-guide/utilizing-core-apis/writing-payment-method-module