# Page Redirection Workflow

## PAYON

{% file src="/files/-MZHCCMSM4CoqHMpGBtz" %}
PAYON\_Page\_Redirection\_Workflow
{% endfile %}

![Figure 01: PAYON Page Redirection](/files/-MZHCUQYFLJczHYJSjM_)

## Simple Redirect URL Implementation

{% tabs %}
{% tab title="JAVA" %}

```java
public class MyController {

	@Autowired
	private RestOperations restTemplate;
	
	@RequestMapping(value="/order/complete",params={"txId"})
	public Mono<String> getOrderComplete(Model model, @RequestParam("txId") String txId) {
    
    //STEP01:Get Transaction Status endpoint
		String url = "https://pg.payon.com.kh:35505/pg/transaction/status";
		
		//STEP02: Init payment status request
		JSONObject paymentStatusReq = new JSONObject();
    paymentStatusReq.put("txId", txId);
    paymentStatusReq.put("merchantId", "YOUR MERCHANT ID");
    paymentStatusReq.put("termId", "YOUR TERM ID");
 
		//STEP03: Request to PAYON's PG server to get order's status
		MyPaymentResultModel paymentResult = restTemplate.postForObject(url, paymentStatusReq, String.class);
		
		//STEP04: Mappe payment result to model
		model.addAttribute("paymentResult", paymentResult);

		//STEP05: Render to the view and mapping with payment result
		return Mono.just("YOUR VIEW NAME");
	}
	
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.payon.com.kh/work-flows/page-redirection-workflow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
