Example #1
0
        public CaptureExamples()
        {
            //This is the URL to connect to your gateway instance. If you are in doubt contact support.
            //For test, use: testgateway.altapaysecure.com
            string gatewayUrl = "https://testgateway.altapaysecure.com/merchant/API/";

            //username to be authenticated on the gateway
            string username = "******";

            //provided password for user authentication
            string password = "******";

            //Instatiation of the API helper class which provide all necessary merchant api methods
            //This class requires gateway URL, username and password params are forwarded in the contructor
            _api = new MerchantApi(gatewayUrl, username, password);
        }
Example #2
0
        public void HandleNotification(NameValueCollection postParameters, IMerchantApi merchantApi)
        {
            PaymentResult paymentResult = merchantApi.ParsePostBackXmlResponse(postParameters["xml"]) as PaymentResult;

            //
            // the posted data contains a "status" field, which is where you can see what kind of notification this is
            //
            if (postParameters["status"].Equals("ChargebackEvent"))
            {
                //
                // something chargeback related happened
                // could be the chargeback itself, a dispute etc
                //
                foreach (ChargebackEvent cbe in paymentResult.Payment.ChargebackEvents)
                {
                    // do whatever you need to do
                }
            }

            else
            {
                //
                // payment status changed
                //

                // check the amounts against what you expect them to be and act accordingly
                var reservedAmount = paymentResult.Payment.ReservedAmount;
                var capturedAmount = paymentResult.Payment.CapturedAmount;
                var refundedAmount = paymentResult.Payment.RefundedAmount;

                // or even better... check the ReconciliationIdentifiers, which
                // contains information on captures and refunds (nothing else)
                foreach (ReconciliationIdentifier refundOrCapture in paymentResult.Payment.ReconciliationIdentifiers)
                {
                }
            }
        }
 public void Setup()
 {
     _api = new MerchantApi(GatewayConstants.gatewayUrl, GatewayConstants.username, GatewayConstants.password);
 }
 public MerchantService()
 {
     _merchantApi = RestService.For <IMerchantApi>("https://localhost:5003/api");
 }