You can call this operation to configure pay-by-requester mode for a bucket.

Note You can set the payer to BucketOwner or Requester.
  • If the bucket has pay-by-requester mode enabled, access from anonymous users is denied.
  • If the bucket has pay-by-requester mode enabled and the requester is not the bucket owner, the requester must include the x-oss-request-payer: requester request header. This way, the requester understands that their requests and data downloads incur fees. x-oss-request-charged: requester is included in the server response. If the oss-request-payer: requester request header is not included, the access is denied.

Request syntax

PUT /? requestPayment HTTP/1.1
Date: GMT Date
Content-Length: ContentLength
Content-Type: application/xml
Host: BucketName.oss.aliyuncs.com
Authorization: SignatureValue 
<? xml version="1.0" encoding="UTF-8"? >
<RequestPaymentConfiguration>
  <Payer>Requester</Payer>
</RequestPaymentConfiguration>

Request elements

Element Type Required Description
RequestPaymentConfiguration Container Yes Specifies the container for the payer.

Child: Payer

Payer String Yes Specifies who pays the download and request fees.

Valid values: BucketOwner and Requester

Parent: RequestPaymentConfiguration

Examples

Request sample
PUT /? requestPayment
Content-Length: 83
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Tue, 23 Jul 2019 01:33:47 GMT
Authorization: OSS LTAIC***********:FsDgQiO+RMwLq***********
<RequestPaymentConfiguration><Payer>Requester</Payer></RequestPaymentConfiguration>
Response sample
200 (OK)
content-length: 0
x-oss-request-id: 5D3663FBB007B79097FC****
date: Tue, 23 Jul 2019 01:33:47 GMT

SDKs

SDKs that support this operation use the following languages:

Error codes

Error code HTTP status code Description
NoSuchBucket 404 The error message returned because the specified bucket does not exist.