@@ -19,14 +19,12 @@ public static function getQRCodeUrl(float $amount, string $chargeId): string
1919 $ accountNumber = get_payment_setting ('account_number ' , PAYFS_PAYMENT_METHOD_NAME );
2020 $ accountName = get_payment_setting ('account_holder ' , PAYFS_PAYMENT_METHOD_NAME );
2121
22- // VietQR API format: https://img.vietqr.io/image/{BANK_ID}-{ACCOUNT_NO}-{TEMPLATE}.jpg
2322 $ baseUrl = sprintf (
2423 'https://img.vietqr.io/image/%s-%s-compact2.jpg ' ,
2524 $ bankCode ,
2625 $ accountNumber
2726 );
2827
29- // Add query parameters
3028 $ params = http_build_query ([
3129 'amount ' => $ amount ,
3230 'addInfo ' => $ chargeId ,
@@ -108,10 +106,13 @@ public static function getChargeIdFrom(string $content): ?string
108106 {
109107 $ prefix = get_payment_setting ('prefix ' , PAYFS_PAYMENT_METHOD_NAME , 'SHD ' );
110108
111- preg_match ('/( ' . preg_quote ($ prefix , '/ ' ) . '\d+)/ ' , $ content , $ matches );
109+ // Match prefix + optional separator (hyphen, space, or none) + digits
110+ preg_match ('/( ' . preg_quote ($ prefix , '/ ' ) . ')[\-\s]?(\d+)/ ' , $ content , $ matches );
112111
113- if (isset ($ matches [1 ])) {
114- return $ matches [1 ];
112+ if (isset ($ matches [1 ]) && isset ($ matches [2 ])) {
113+ // Return normalized format: PREFIX + DIGITS (no separator)
114+ // This matches how charge_id is generated in PayFSPaymentService
115+ return $ matches [1 ] . $ matches [2 ];
115116 }
116117
117118 return null ;
0 commit comments