• Hello Team,

    I have created a payment plugin.

    Below code is in the process_payment function:

    //total amount added on 1 July 2022 1:52 pm
    			$totalAmount = $order->get_total();
    			$totalAmount_CNY = wc_format_decimal( $totalAmount * 5, 2 );
    			//RSA and payload details added on 1 July 2022
    			/*$totalAmount="0.01" */
    			$appID="1000000661";
    			/*$merTradeNo=""; */
    			$paymentType="S";
    			$publicKey="MIIAAQ==";
    			$apiKey="BH+QyvF1KvOoZlA==";
    
    			$payload=array(
    			"totalPrice"=>$totalAmount_CNY,
    			"currency"=>$merTradeNo,
    			"notifyURL"=>"https://www.myt.mu",
    			"returnURL"=>"https://www.myt.mu",
    			"remark"=>"This is a test payment",
    			lang=>"en"
    			);
    
    			//code to generate signature
    			$payload=json_encode($payload);
    			$rsa= new \wamp642\www\transportation\wordpress\wp-content\phpseclib\phpseclib\Crypt\RSA();
    			$rsa->setHash('sha1');
    			$rsa->setMGFHash('sha1');
    			$rsa->setEncryptionMode(RSA::ENCRYPTION_OAEP);
    			$rsa->setPublicKeyFormat(RSA::PUBLIC_FORMAT_PKCS1);
    			$rsa->loadKey($publickey);
    			$encryptedPayload=base64_encode($rsa->encrypt($payload));
    			$signaturedata="appID&merTradeNo=$merTradeNo$merTradeNo&payload=$encryptedPayload&paymentType=$paymentType";
    			$sign=base64_encode(hash_hmac('sha512',$signaturedata,$apiKey,true));

    kindly advise how to redirect to below URL below and pass the $parameters to URL

    https://transportation.local/wordpress/redirect/

    Thanks,

    Roshan

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You can use wp_redirect() as long as no other output has yet occurred. If it has, you need to redirect via JavaScript.

    You can pass limited data with the redirect URL as an URL query string. If the data is too extensive or too sensitive to pass this way, I recommend creating a PHP session to temporarily save data between requests.

Viewing 1 replies (of 1 total)
  • The topic ‘redirection PHP’ is closed to new replies.