Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Alert Pay Php API

[es] :: PHP :: Alert Pay Php API

[ Pregleda: 1719 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

j4m0r3

Član broj: 146455
Poruke: 95
*.dynamic.isp.telekom.rs.



+19 Profil

icon Alert Pay Php API28.11.2011. u 18:55 - pre 151 meseci
Jel moze mala pomoc oko Alert PAY validacije, kada korisnik procesira naplatu sa svojim id i emailom , to treba da prosedim apay-u , a onda kada se odradi napalata, treba da mi vrate iste te podatke, dakle nesto sa $_POST ..?
Hvala
 
Odgovor na temu

Zlatni_bg
Nikola S
Beograd

Član broj: 65708
Poruke: 4420
*.dynamic.sbb.rs.



+498 Profil

icon Re: Alert Pay Php API28.11.2011. u 19:54 - pre 151 meseci
Uh izvini, nasao sam laksi nacin.

https://dev.alertpay.com/en/in...tml-integration/ipn-guide.html

Evo ti kod sample stranice, tacnije tvog payment procesora:

Code (php):

<?php
/**
 *
 * Sample IPN Handler for Item Payments
 *
 * The purpose of this code is to help you to understand how to process the Instant Payment Notification
 * variables for a payment received through AlertPay's buttons and integrate it in your PHP site. The following
 * code will ONLY handle ITEM payments. For handling IPNs for SUBSCRIPTIONS, please refer to the appropriate
 * sample code file.
 *   
 * Put this code into the page which you have specified as Alert URL.
 * The variables being read from the $_POST object in the code below are pre-defined IPN variables and the
 * the conditional blocks provide you the logical placeholders to process the IPN variables. It is your responsibility
 * to write appropriate code as per your requirements.
 *   
 * If you have any questions about this script or any suggestions, please visit us at: dev.alertpay.com
 *
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY
 * OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
 * LIMITED TO THE IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @author AlertPay
 * @copyright 2010
 */

 
     //The value is the Security Code generated from the IPN section of your AlertPay account. Please change it to yours.
     define("IPN_SECURITY_CODE", "xxxxxxxxxxxxxxxx");
     define("MY_MERCHANT_EMAIL", "[email protected]");

     //Setting information about the transaction
     $receivedSecurityCode = $_POST['ap_securitycode'];
     $receivedMerchantEmailAddress = $_POST['ap_merchant'];
     $transactionStatus = $_POST['ap_status'];
     $testModeStatus = $_POST['ap_test'];    
     $purchaseType = $_POST['ap_purchasetype'];
     $totalAmountReceived = $_POST['ap_totalamount'];
     $feeAmount = $_POST['ap_feeamount'];
    $netAmount = $_POST['ap_netamount'];
     $transactionReferenceNumber = $_POST['ap_referencenumber'];
     $currency = $_POST['ap_currency'];      
     $transactionDate= $_POST['ap_transactiondate'];
     $transactionType= $_POST['ap_transactiontype'];
     
     //Setting the customer's information from the IPN post variables
     $customerFirstName = $_POST['ap_custfirstname'];
     $customerLastName = $_POST['ap_custlastname'];
     $customerAddress = $_POST['ap_custaddress'];
     $customerCity = $_POST['ap_custcity'];
     $customerState = $_POST['ap_custstate'];
     $customerCountry = $_POST['ap_custcountry'];
     $customerZipCode = $_POST['ap_custzip'];
     $customerEmailAddress = $_POST['ap_custemailaddress'];
     
     //Setting information about the purchased item from the IPN post variables
     $myItemName = $_POST['ap_itemname'];
     $myItemCode = $_POST['ap_itemcode'];
     $myItemDescription = $_POST['ap_description'];
     $myItemQuantity = $_POST['ap_quantity'];
     $myItemAmount = $_POST['ap_amount'];
     
     //Setting extra information about the purchased item from the IPN post variables
     $additionalCharges = $_POST['ap_additionalcharges'];
     $shippingCharges = $_POST['ap_shippingcharges'];
     $taxAmount = $_POST['ap_taxamount'];
     $discountAmount = $_POST['ap_discountamount'];
     
     //Setting your customs fields received from the IPN post variables
     $myCustomField_1 = $_POST['apc_1'];
     $myCustomField_2 = $_POST['apc_2'];
     $myCustomField_3 = $_POST['apc_3'];
     $myCustomField_4 = $_POST['apc_4'];
     $myCustomField_5 = $_POST['apc_5'];
     $myCustomField_6 = $_POST['apc_6'];

     if ($receivedMerchantEmailAddress != MY_MERCHANT_EMAIL) {
          // The data was not meant for the business profile under this email address.
          // Take appropriate action
     }
     else {    
          //Check if the security code matches
          if ($receivedSecurityCode != IPN_SECURITY_CODE) {
               // The data is NOT sent by AlertPay.
               // Take appropriate action.
          }
          else {
               if ($transactionStatus == "Success") {
                    if ($testModeStatus == "1") {
                         // Since Test Mode is ON, no transaction reference number will be returned.
                         // Your site is currently being integrated with AlertPay IPN for TESTING PURPOSES
                         // ONLY. Don't store any information in your production database and
                         // DO NOT process this transaction as a real order.
                    }
                    else {
                         // This REAL transaction is complete and the amount was paid successfully.
                         // Process the order here by cross referencing the received data with your database.                                                                      
                         // Check that the total amount paid was the expected amount.
                         // Check that the amount paid was for the correct service.
                         // Check that the currency is correct.
                         // ie: if ($totalAmountReceived == 50) ... etc ...
                         // After verification, update your database accordingly.
                    }              
               }
               else {
                         // Transaction was cancelled or an incorrect status was returned.
                         // Take appropriate action.
               }
          }
     }
?>
 

THE ONLY EASY DAY WAS YESTERDAY
 
Odgovor na temu

j4m0r3

Član broj: 146455
Poruke: 95
*.dynamic.isp.telekom.rs.



+19 Profil

icon Re: Alert Pay Php API28.11.2011. u 20:00 - pre 151 meseci
E hvala ti , vec puno pomoci od tebe! ;) Sad cu da probam
 
Odgovor na temu

[es] :: PHP :: Alert Pay Php API

[ Pregleda: 1719 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.